PageSourceSearch

https://classroom.freckle.com/js/index-h8BnvbLK.js

js freckle.com collected 2026-10-01 13:51:29 UTC 7,866 bytes, 2 lines download raw bytes

1import{ae as e,af as r,bJ as a,j as s,d as t,u as n,_ as R,e as i,a as _,H as l,T as o,a1 as c,r as E,aR as d,Q as A,$ as m,a0 as I,g as f,aO as M,V as p,L as u,k as h,bK as L,ai as g,am as x,Z as j}from"./index-DwY57-TY.js";import{T as P}from"./table-JwqQO3dF.js";import{c as T}from"./table-DqbDCvXI.js";import"/config.js";const G=()=>{const{t:e}=n();return s.jsxs("div",{className:"_description_37o18_93",children:[s.jsx(R,{className:"_bannerTitle_37o18_85",children:e("PREMIUM_REFERRAL_PROGRAM_BANNER_TITLE")}),s.jsx(i,{className:"_bannerSubTitle_37o18_89",children:e("PREMIUM_REFERRAL_PROGRAM_BANNER_SUBTITLE")})]})},O=()=>s.jsx(t,{flexDirection:"column",justifyContent:"flex-end",children:s.jsx("img",{src:`${_.imageAssetsUrl}/teacher-dashboard/referral-program/elephants.svg`})}),y=()=>s.jsxs(t,{className:"_banner_37o18_80",children:[s.jsx(G,{}),s.jsx(O,{})]}),N=e=>{const{gift:r}=e,a=(e=>{switch(e){case"textbook-bookmark":return`${_.imageAssetsUrl}/teacher-dashboard/referral-program/bookmark.png`;case"triangle-coloring-activity":return`${_.imageAssetsUrl}/teacher-dashboard/referral-program/triangle.png`;case"letter-tracing-activity":return`${_.imageAssetsUrl}/teacher-dashboard/referral-program/letters.png`;case"geometry-activity":return`${_.imageAssetsUrl}/teacher-dashboard/referral-program/geometry.png`;default:return c.exhaustive(e)}})(r);return s.jsx(t,{alignItems:"center",justifyContent:"center",flexDirection:"column",className:"_previewGiftCard_37o18_190",children:s.jsx(t,{alignItems:"center",justifyContent:"center",children:s.jsx("img",{className:"_cardImg_37o18_157",src:a})})})},F=()=>{const{t:e}=n();return s.jsxs(t,{flexDirection:"column",alignItems:"center",className:"_previewSectionContainer_37o18_170",gap:"16px",children:[s.jsx(l,{children:e("PREMIUM_REFERRAL_PROGRAM_PREVIEW_SECTION_HEADER")}),s.jsx(t,{flexDirection:"row",justifyContent:"center",className:"_previewSection_37o18_170",children:["textbook-bookmark","triangle-coloring-activity","letter-tracing-activity","geometry-activity"].map((e,r)=>s.jsx(N,{gift:e},r))}),s.jsx(o,{className:"_descriptionText_37o18_164",children:e("PREMIUM_REFERRAL_PROGRAM_PREVIEW_SECTION_DESCRIPTION")})]})},S=({teacherId:r})=>{const{t:R}=n(),[i,_]=E.useState(""),[o,M]=E.useState(""),[p,u]=E.useState(""),h=d(s=>(async(r,s)=>{await e.POST("/3/teachers/{V3TeacherReferralsR-TeacherId}/referrals",{params:{path:{"V3TeacherReferralsR-TeacherId":r}},body:s}).then(a)})(r,s),{invalidate:["fetchReferrals",r]}),L=h.isPending;return s.jsxs(t,{justifyContent:"center",alignItems:"center",flexDirection:"column",className:"_referralForm_37o18_98",gap:"8px",children:[s.jsx(l,{children:R("PREMIUM_REFERRAL_PROGRAM_REFERRAL_LINK_HEADER")}),s.jsx("form",{onSubmit:async e=>{if(e.preventDefault(),M(""),u(""),f(i))try{await h.mutateAsync({recipientEmailAddress:i.trim()}),u(R("PREMIUM_REFERRAL_PROGRAM_SUCCESS_MESSAGE")),_("")}catch(r){if((e=>null!=e&&"object"==typeof e&&"status"in e&&"number"==typeof e.status&&"response"in e&&"object"==typeof e.response&&null!==e.response&&"json"in e.response&&"object"==typeof e.response.json&&null!==e.response.json&&"validationErrors"in e.response.json&&Array.isArray(e.response.json.validationErrors))(r)&&400===r.status){const e=r.response.json.validationErrors[0];if(void 0!==e){const r=e.name;switch(r){case"invalid-email-address":M(R("PREMIUM_REFERRAL_PROGRAM_INVALID_EMAIL_MESSAGE"));break;case"already-referred":M(R("PREMIUM_REFERRAL_PROGRAM_ALREADY_REFERRED_MESSAGE"));break;default:M(R("PREMIUM_REFERRAL_PROGRAM_GENERAL_FAILURE_MESSAGE")),c.exhaustive(r)}}else M(R("PREMIUM_REFERRAL_PROGRAM_GENERAL_FAILURE_MESSAGE"))}else M(R("PREMIUM_REFERRAL_PROGRAM_GENERAL_FAILURE_MESSAGE"))}else M(R("PREMIUM_REFERRAL_PROGRAM_INVALID_EMAIL_MESSAGE"))},children:s.jsxs(t,{gap:"10px",justifyContent:"center",alignItems:"center",children:[s.jsxs("div",{className:"_referralEmailInput_37o18_112",children:[s.jsx("input",{type:"email",value:i,onChange:e=>{_(e.target.value),(o||p)&&(M(""),u(""))},placeholder:R("PREMIUM_REFERRAL_PROGRAM_REFERRAL_INPUT_PLACEHOLDER"),required:!0,disabled:L,"aria-label":R("PREMIUM_REFERRAL_PROGRAM_REFERRAL_INPUT_PLACEHOLDER"),id:"referral-link-input"}),s.jsx("button",{id:"referral-link-submit-button",type:"submit",disabled:L||!i.trim(),children:R(L?"PREMIUM_REFERRAL_PROGRAM_REFERRAL_LINK_SENDING_CTA":"PREMIUM_REFERRAL_PROGRAM_REFERRAL_LINK_CTA")})]}),o?s.jsx(A,{type:"premium",icon:m,className:"_alertFailureStyle_37o18_152",children:o}):null,p?s.jsx(A,{type:"premium",icon:I,className:"_alertSuccessStyle_37o18_147",children:p}):null]})})]})},U=["Younger_Grades_Bookmark.pdf","Older_Grades_Bookmark.pdf","Color_Style_Bookmark.pdf","Triangle_Coloring_Activity.pdf","Letter_Tracing_Activity.pdf","Geometry_Activity.pdf"],C=e=>{switch(e){case"Older_Grades_Bookmark.pdf":return"PREMIUM_REFERRAL_PROGRAM_OLDER_BOOKMARK_GIFT_DESCRIPTION";case"Younger_Grades_Bookmark.pdf":return"PREMIUM_REFERRAL_PROGRAM_YOUNGER_BOOKMARK_GIFT_DESCRIPTION";case"Color_Style_Bookmark.pdf":return"PREMIUM_REFERRAL_PROGRAM_COLOR_STYLE_BOOKMARK_GIFT_DESCRIPTION";case"Triangle_Coloring_Activity.pdf":return"PREMIUM_REFERRAL_PROGRAM_TRIANGLE_COLORING_ACTIVITY_GIFT_DESCRIPTION";case"Letter_Tracing_Activity.pdf":return"PREMIUM_REFERRAL_PROGRAM_LETTER_TRACING_ACTIVITY_GIFT_DESCRIPTION";case"Geometry_Activity.pdf":return"PREMIUM_REFERRAL_PROGRAM_GEOMETRY_ACTIVITY_GIFT_DESCRIPTION";default:return c.exhaustive(e)}},b=e=>e.map((e,r)=>{const a=(e=>{const r=e%U.length,a=U[r];if(void 0===a)throw new Error(`Invalid gift index: ${r}`);return a})(r),s=(e=>`${_.prodAssetsUrl}/static/teacher-dashboard/referral-program/${e}`)(a);return{...e,giftFileName:a,giftUrl:s}}),v=()=>{const{t:e}=n();return s.jsxs(t,{flexDirection:"column",justifyContent:"center",alignItems:"center",className:"_emptyReferralList_37o18_220",gap:"16px",children:[s.jsx("img",{src:`${_.imageAssetsUrl}/teacher-dashboard/referral-program/present.svg`}),s.jsx(o,{style:"caption-2",modifiers:["muted"],children:e("PREMIUM_REFERRAL_PROGRAM_REFERRALS_EMPTY")})]})},D=e=>{const{referrals:r}=e,{t:a}=n(),R=b(M.nonEmptyToArray(r));return s.jsx(P,{data:R,columns:[{Header:a("PREMIUM_REFERRAL_PROGRAM_REFERRALS_TABLE_DOWNLOADABLE_LINK_HEADER"),accessor:e=>e.giftFileName,Cell:T(e=>s.jsx(t,{alignItems:"center",children:s.jsx(u,{href:e.giftUrl,target:"_blank",rel:"noopener noreferrer",reactRouter:!1,children:s.jsxs(t,{alignItems:"center",gap:"4px",children:[s.jsx(o,{style:"body-2",htmlElement:"span",className:"_linkStyle_37o18_216",children:a(C(e.giftFileName))}),s.jsx(h,{icon:L})]})})})),id:"downloadableGift",alignment:"left"},{Header:a("PREMIUM_REFERRAL_PROGRAM_REFERRALS_TABLE_COLLEAGUE_HEADER"),accessor:e=>e.recipientEmailAddress,Cell:T(e=>s.jsx(o,{style:"body-2",children:e.recipientEmailAddress})),id:"referredTeacherEmail",alignment:"left"}]})},k=e=>{const{referrals:r}=e,{t:a}=n(),R=M.mkNonEmpty(r);return s.jsxs(t,{flexDirection:"column",alignItems:"center",gap:"16px",className:"_downloadableRewardsContainer_37o18_207",children:[s.jsx(l,{children:a("PREMIUM_REFERRAL_PROGRAM_REFERRALS_SUBTITLE")}),s.jsx("div",{className:"_referralContainer_37o18_211",children:s.jsx("div",{className:"_referralListContainer_37o18_196",children:p.maybe(()=>s.jsx(v,{}),e=>s.jsx(D,{referrals:e}),R)})})]})},B=e=>{const{teacher:r,referrals:a}=e;return s.jsxs(t,{className:"_topLevelContainer_37o18_73",flexDirection:"column",children:[s.jsx(y,{}),s.jsx(S,{teacherId:r.id}),s.jsx(F,{}),s.jsx(k,{referrals:a})]})};function w(){var a;const t=g(),n=x(({teacher:a})=>(async a=>e.GET("/3/teachers/{V3TeacherReferralsR-TeacherId}/referrals",{params:{path:{"V3TeacherReferralsR-TeacherId":a}}}).then(r))(a.id),"fetchReferrals",[null==(a=t.data)?void 0:a.id],{teacher:t});return s.jsx(j,{resources:{teacher:t,referrals:n},render:e=>s.jsx(B,{...e})})}
1export{w as default};
2//# sourceMappingURL=index-h8BnvbLK.js.map

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.