PageSourceSearch

https://thewhiskylist.com.au/assets/afa0a06f.js

js thewhiskylist.com.au collected 2026-10-01 15:56:57 UTC 6,319 bytes, 2 lines download raw bytes

1import{r as a,i as l,j as t}from"./index.63186e17.js";import"./9ce848a0.js";import"./3ff748a6.js";import"./9ec771b6.js";import"./96cbebeb.js";import{u as F}from"./1a679d4b.js";import{u as I}from"./2f494d5c.js";import{S as W}from"./d5314dc5.js";import{S as j}from"./1a60deb7.js";import{useMyProfile as D}from"./df1e0f22.js";import{c as O}from"./8622e3f8.js";import{S as R}from"./e946ef88.js";import{R as L}from"./6b34e5af.js";import"./650818a9.js";import"./1fbf5f25.js";import"./886de47d.js";import"./4abb4d00.js";import"./dbd6de00.js";import"./7c4fc7c6.js";import"./1f7670d9.js";import"./043bf578.js";import"./4b45f7f6.js";import"./6eef1b78.js";import"./a07afe4c.js";import"./7dfd4c4d.js";import"./4cde71d8.js";import"./cc9718ab.js";import"./0150fe50.js";import"./cccc58de.js";import"./aac1b719.js";import"./8024cca8.js";import"./124b31fc.js";import"./614e5bd7.js";import"./e392eb08.js";import"./43b9d8f8.js";import"./07e8cc69.js";import"./650f62d5.js";import"./cdc26ce9.js";import"./2859c860.js";import"./e4d06e96.js";import"./a415dba3.js";import"./8f5aad1c.js";import"./7f88e4d8.js";import"./eefea5b3.js";import"./e007319b.js";import"./45f7240b.js";import"./47676fc9.js";import"./7853524d.js";import"./3f7dba3b.js";import"./d4225db6.js";import"./2eefcb91.js";function U({label:p,labelClassName:b,labeledOptions:e,name:h,values:d,placeholder:v,noOptionsMessage:_,onChange:f,error:m}){const g=a.exports.useMemo(()=>!!m,[m]),c=a.exports.useCallback(i=>f(i.map(({value:u})=>u)),[f]),s=a.exports.useMemo(()=>d.map(i=>e.find(({value:u})=>u===i)),[e,d]);return l("label",{className:O("col-md-12",b),children:[t("span",{className:"form__element-text",children:p}),t(R,{name:h,value:s,options:e,onChange:c,placeholder:v,noOptionsMessage:()=>_,components:{IndicatorSeparator:null,DropdownIndicator:()=>t("span",{className:"select__indicator"})},className:"mt-10",theme:i=>({...i,borderRadius:3,colors:{...i.colors,primary:"#52b85a",primary75:"#52b85a",primary50:"#52b85a",neutral20:"#b3b3b3"}}),styles:{valueContainer:i=>({...i,paddingLeft:"18rem"}),control:i=>({...i,boxShadow:"none",height:"54rem"})},isSearchable:!1,closeMenuOnSelect:!1,isClearable:!1,isMulti:!0}),g&&t("p",{className:"error-msg",children:m})]})}const Y=["hate","like","love"];function Le({communicationChannels:p}){var k,y,S,w;const b=a.exports.useMemo(()=>p.map(({name:r,slug:o})=>({label:r,value:o})),[p]),{myProfile:e,setMyProfile:h}=D(),d=a.exports.useMemo(()=>!(e!=null&&e.can_receive_marketing_notifications),[e==null?void 0:e.can_receive_marketing_notifications]),[v,_]=a.exports.useState(!1);a.exports.useEffect(()=>{e&&_(e.activity_stats.total_watched===0)},[e]);const[f,m]=a.exports.useState(!1),g=a.exports.useCallback(r=>{m(!1),h(r)},[h]),{formFields:c,setFormFields:s,handleSubmit:i,isSuccess:u}=I(F,{preferred_communication_channels:(k=e==null?void 0:e.preferred_communication_channels)!=null?k:[],can_receive_marketing_notifications:(y=e==null?void 0:e.can_receive_marketing_notifications)!=null?y:null,whisky_style_preferences:(S=e==null?void 0:e.whisky_style_preferences)!=null?S:[]},{onSuccess:g});a.exports.useEffect(()=>{u&&j.fire({title:"Communication preferences saved successfully!",icon:"success"})},[u]),a.exports.useEffect(()=>{if(f){const r=o=>{o.preventDefault(),o.returnValue="You may lose unsaved data if you continue."};return window.addEventListener("beforeunload",r),()=>window.removeEventListener("beforeunload",r)}},[f]),a.exports.useEffect(()=>{if(e){const{preferred_communication_channels:r,can_receive_marketing_notifications:o,whisky_style_preferences:n}=e;s({preferred_communication_channels:r,can_receive_marketing_notifications:o,whisky_style_preferences:n!=null?n:[]})}},[e,s]);const C=a.exports.useCallback(r=>{s(o=>({...o,preferred_communication_channels:r})),m(!0)},[s]),x=a.exports.useCallback(r=>{s(o=>({...o,can_receive_marketing_notifications:r.target.value,...d&&{preferred_communication_channels:p.filter(({is_default_channel:n})=>n).map(({slug:n})=>n)}})),m(!0)},[p,s,d]),N=a.exports.useMemo(()=>[!0,"true"].includes(c.can_receive_marketing_notifications),[c.can_receive_marketing_notifications]),M=a.exports.useCallback(r=>{m(!0),s(o=>({...o,whisky_style_preferences:o.whisky_style_preferences.map(n=>({...n,...r.target.name===n.uuid&&{value:r.target.value}}))}))},[s]);return l("div",{className:"signup__form form",children:[l("form",{onSubmit:i,children:[l("div",{className:"form__row row",children:[t(W,{labelClassName:"col-md-12",label:"Would you like to receive announcements and exclusive offers?",labeledOptions:{yes:{value:"true",label:"Yes - count me in"},no:{value:"false",label:"No - I don't want all the goodies"}},name:"can_receive_marketing_notifications",value:c.can_receive_marketing_notifications,onChange:x}),t("div",{className:"col-md-12 mt-30",children:t(L,{isDisabled:v,onClickSuccess:()=>_(!0)})}),N&&t(U,{labelClassName:"mt-25",label:"Your preferred communication channels?",labeledOptions:b,name:"preferred_communication_channels",values:c.preferred_communication_channels,onChange:C,noOptionsMessage:"No other communication channels",placeholder:"Select your communication channels..."})]}),((w=c.whisky_style_preferences)==null?void 0:w.length)>0&&l("div",{children:[t("p",{className:"mt-30 mb-20",children:"What are you preferences for the major styles of whisky?"}),l("table",{className:"pref-table",children:[t("thead",{children:l("tr",{children:[t("th",{}),t("th",{children:"Hate it, don't even tell me about them"}),t("th",{children:"I like it, please let me know about them"}),t("th",{children:"My favourite, get more of these please!"})]})}),t("tbody",{children:c.whisky_style_preferences.map(r=>l("tr",{children:[t("td",{children:r.name}),Y.map(o=>t("td",{children:l("label",{className:"radio",children:[t("input",{type:"radio",value:o,name:r.uuid,id:`${r.uuid}-${o}`,checked:c.whisky_style_preferences.some(({uuid:n,value:E})=>n===r.uuid&&E===o),onChange:M}),t("span",{className:"checkmark"})]})},o))]},r.uuid))})]})]}),t("div",{className:"form__row row signup__submit",children:t("div",{className:"col-md-12",children:t("button",{type:"submit",className:"button button_form button_full button_size_large",children:"Save Preferences"})})})]}),t("div",{className:"form__row mt-30 communications__links"})]})}
1export{Le as default};
2//# sourceMappingURL=afa0a06f.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.