PageSourceSearch

https://sharethemeal.org/assets/signInModalContext-BotCBKQ8.js

js sharethemeal.org collected 2026-09-24 08:43:54 UTC 8,309 bytes, 1 lines download raw bytes

1import{R as m,t as l,z as Z,A as ee,I as te}from"./chunk-4N6VE7H7-Exqj4PTM.js";import{m as R,a as i,t as T}from"./utils-DIUWyMmR.js";import{k}from"./index-Cp7v22Jw.js";import{U as y,I as B,Q as ne,N as V}from"./constants-CmaRX5ba.js";import{u as re}from"./usePathWithLocale-CLIIL5Qu.js";import{u as ae}from"./useRootData-fFXhC2hW.js";import{i as oe}from"./amplitudeContext-Cg1Mbi4A.js";import{u as ie}from"./useTranslation-AnhJcB0n.js";var se=["className","cssModule","tabs","pills","vertical","horizontal","justified","fill","navbar","card","tag"];function N(){return N=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},N.apply(this,arguments)}function le(e,t){if(e==null)return{};var a=ce(e,t),n,r;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function ce(e,t){if(e==null)return{};var a={},n=Object.keys(e),r,o;for(o=0;o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&(a[r]=e[r]);return a}var fe={card:i.bool,className:i.string,cssModule:i.object,fill:i.bool,horizontal:i.oneOf(["center","end"]),justified:i.bool,navbar:i.bool,pills:i.bool,tabs:i.bool,tag:T,vertical:i.oneOfType([i.bool,i.string])},ue=function(t){return t===!1?!1:t===!0||t==="xs"?"flex-column":"flex-".concat(t,"-column")};function pe(e){var t=e.className,a=e.cssModule,n=e.tabs,r=e.pills,o=e.vertical,c=o===void 0?!1:o,f=e.horizontal,u=e.justified,h=e.fill,g=e.navbar,p=e.card,v=e.tag,O=v===void 0?"ul":v,S=le(e,se),I=R(k(t,g?"navbar-nav":"nav",f?"justify-content-".concat(f):!1,ue(c),{"nav-tabs":n,"card-header-tabs":p&&n,"nav-pills":r,"card-header-pills":p&&r,"nav-justified":u,"nav-fill":h}),a);return m.createElement(O,N({},S,{className:I}))}pe.propTypes=fe;var me=["className","cssModule","active","tag"];function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},w.apply(this,arguments)}function ge(e,t){if(e==null)return{};var a=ve(e,t),n,r;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function ve(e,t){if(e==null)return{};var a={},n=Object.keys(e),r,o;for(o=0;o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&(a[r]=e[r]);return a}var be={active:i.bool,className:i.string,cssModule:i.object,tag:T};function de(e){var t=e.className,a=e.cssModule,n=e.active,r=e.tag,o=r===void 0?"li":r,c=ge(e,me),f=R(k(t,"nav-item",n?"active":!1),a);return m.createElement(o,w({},c,{className:f}))}de.propTypes=be;function M(e){"@babel/helpers - typeof";return M=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(e)}var ye=["className","cssModule","active","tag","innerRef"];function C(){return C=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},C.apply(this,arguments)}function he(e,t){if(e==null)return{};var a=Oe(e,t),n,r;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Oe(e,t){if(e==null)return{};var a={},n=Object.keys(e),r,o;for(o=0;o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&(a[r]=e[r]);return a}function Se(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ie(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _e(e,t,a){return t&&Ie(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function je(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&E(e,t)}
1function E(e,t){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},E(e,t)}function Pe(e){var t=we();return function(){var n=j(e),r;if(t){var o=j(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Ne(this,r)}}function Ne(e,t){if(t&&(M(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return F(e)}function F(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function we(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function j(e){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},j(e)}var Me={active:i.bool,className:i.string,cssModule:i.object,disabled:i.bool,href:i.any,innerRef:i.oneOfType([i.object,i.func,i.string]),onClick:i.func,tag:T},Ce=(function(e){je(a,e);var t=Pe(a);function a(n){var r;return Se(this,a),r=t.call(this,n),r.onClick=r.onClick.bind(F(r)),r}return _e(a,[{key:"onClick",value:function(r){if(this.props.disabled){r.preventDefault();return}this.props.href==="#"&&r.preventDefault(),this.props.onClick&&this.props.onClick(r)}},{key:"render",value:function(){var r=this.props,o=r.className,c=r.cssModule,f=r.active,u=r.tag,h=u===void 0?"a":u,g=r.innerRef,p=he(r,ye),v=R(k(o,"nav-link",{disabled:p.disabled,active:f}),c);return m.createElement(h,C({},p,{ref:g,onClick:this.onClick,className:v}))}}]),a})(m.Component);Ce.propTypes=Me;const H=m.createContext({closeSignInModal:()=>{},completeSignInModalFlow:()=>{},isSignInModalOpen:!1,onSignInComplete:()=>{},openSignInModal:()=>{},email:"",setEmail:()=>{},setInitialisedMessage:()=>{},setIsShowingSignUpConfirmation:()=>{},skipNewUserConfirmation:!1,welcomeMessage:null,welcomeImageUrl:null,clearWelcomeMessage:()=>{},isSignInModalClosing:!1}),Ee=m.memo(({children:e})=>{const[t,a]=l.useState(!1),[n,r]=l.useState(null),[o,c]=l.useState(null),[f,u]=l.useState(null),[h,g]=l.useState(),[p,v]=l.useState(""),[O,S]=l.useState(!1),[I,x]=l.useState(!1),[Q,U]=l.useState(!1),{state:L}=Z(),q=ee(),{getPath:J}=re(),[b,$]=te(),{user:d}=ae(),{t:_}=ie(),W=b.get(y.REDIRECT),K=()=>{const s=b.get(y.LOGIN);a(s===V.LOGIN)},X=s=>{$({...Object.fromEntries(b.entries()),[y.LOGIN]:V.LOGIN},{state:L,preventScrollReset:!0}),a(!0),S(!1),U(s?.skipNewUserConfirmation??!1),s?.onSignInComplete?g(()=>s.onSignInComplete):g(void 0)},Y=()=>{c(null),u(null)},A=()=>{const s=Object.fromEntries(b.entries()),{[y.LOGIN]:G,[y.REDIRECT]:z,...P}=s;$(P,{preventScrollReset:!0,state:L}),a(!1),S(!0),x(!1),U(!1)},D=()=>{if(!W){A();return}a(!1),q(J(`/${W}`),{replace:!0})};return l.useEffect(()=>{if(!d||t||!n)return;let s=_("signIn.welcomeBackAnonymous");const G=n===B.NEW_USER?"/icons/sign-in-toast-new-account-icon.svg":"/icons/sign-in-toast-existing-user-icon.svg";n===B.NEW_USER?s=`${_("signIn.confirmationNewUser.header")}!`:d.firstname&&(s=_("signIn.welcomeBack",{Name:d.firstname}));const z=setTimeout(()=>{c(s),u(G)},500),P=setTimeout(()=>{c(null),u(null),r(null)},3500);return()=>{clearTimeout(z),clearTimeout(P)}},[n,t,d,_]),l.useEffect(()=>{const s=b.get(y.LOGIN);if(oe(d)&&s&&!I){D();return}if(O){s||S(!1);return}K()},[b,d,O,I]),ne.jsx(H.Provider,{value:{closeSignInModal:A,completeSignInModalFlow:D,isSignInModalOpen:t,onSignInComplete:h,openSignInModal:X,email:p,setEmail:v,setInitialisedMessage:r,setIsShowingSignUpConfirmation:x,skipNewUserConfirmation:Q,welcomeMessage:o,welcomeImageUrl:f,clearWelcomeMessage:Y,isSignInModalClosing:O},children:m.Children.only(e)})});
1Ee.displayName="SignInModalProvider";const Ae=()=>l.useContext(H);export{pe as N,Ee as S,de as a,Ce as b,Ae as u};

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.