PageSourceSearch

https://www.birchbox.co.uk/_next/static/chunks/pages/members-market-88351b9f6712ab73.js

js birchbox.co.uk collected 2026-10-02 15:09:40 UTC 13,079 bytes, 2 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9302],{27798:(e,t,l)=>{"use strict";l.d(t,{A:()=>o});var s=l(10553),a=l(18559),r=l(58149),n=l(50614),i=l(79684);async function c(e,t,l){var s,a;let c=await (0,i.Jr)(e,t.id,void 0,"success"),o=null;if(c&&c.length>0){let e=null==(s=c[0].external_order_id)?void 0:s.ecommerce;if(e){let t=await (0,n.Y)([e]);o=(null==t?void 0:t.find(t=>t.id.includes(e)))||null}}let d=(null==c?void 0:c.length)||0,x="NONE";1===d?x="NMC":d>1&&(x="RMC");let m=!1;if("RMC"===x){let l=await (0,i.F5)(e,t.id);m=(null!=(a=null==l?void 0:l.charge_attempts)?a:1)>1}let u=async()=>{await (0,r.Tk)("/subscriptions/".concat(l))},p=!1,h=t.charge_interval_frequency?t.charge_interval_frequency-d%t.charge_interval_frequency:0;if((h===t.charge_interval_frequency||1===t.charge_interval_frequency)&&(h=+!(null==o?void 0:o.tags.includes(1===d?"box_customized":"rmc_box_customized"))),t.is_prepaid&&"cancelled"===t.status&&o){let e=o.tags.includes(1===d?"box_customized":"rmc_box_customized");p=h>0||!e}return{...t,address:t.address,status:t.status,numOrders:d,orders:c,lastBox:o,customizationType:x,isDunning:m,revalidate:u,isEndingSoon:p,remainingBoxes:h}}function o(){let{data:e}=(0,s.useSession)(),t=null==e?void 0:e.shopifyAccessToken,{data:l,isValidating:n,mutate:o,error:d}=(0,r.Ay)(t?"/subscriptions/".concat(t):null,async()=>{try{let e=await (0,i.AZ)(t);if(!e)return null;let l=await (0,i.X4)(e,!0);if(!l)return null;return(await Promise.all(l.map(l=>c(e,{...l,address:l.include.address},t)))).sort((e,t)=>"active"===e.status&&"active"!==t.status?-1:"active"!==e.status&&"active"===t.status?1:e.isEndingSoon&&!t.isEndingSoon?-1:!e.isEndingSoon&&t.isEndingSoon?1:0)}catch(e){return console.error("Error fetching subscriptions:",e),a.Cp(e),null}},{revalidateIfStale:!0,revalidateOnMount:!0}),x=void 0===e,m=(null==l?void 0:l.filter(e=>"active"===e.status||e.isEndingSoon))||[],u=(null==l?void 0:l.filter(e=>("cancelled"===e.status||"expired"===e.status)&&!e.isEndingSoon))||[];return{subscriptions:l,activeSubscriptions:m,cancelledSubscriptions:u,loading:n,subscriptionLoading:x,revalidateAll:o,error:d}}},39799:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/members-market",function(){return l(80534)}])},50614:(e,t,l)=>{"use strict";l.d(t,{Y:()=>s}),l(85391);let s=async e=>{let t=encodeURIComponent(e.join(",")),l=await fetch("/api/shopify/order/list/".concat(t));return(await l.json()).data}},80534:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>j});var s=l(37876),a=l(14232),r=l(10553),n=l(62867),i=l(48230),c=l.n(i),o=l(89099),d=l(11752),x=l(46462),m=l(39889),u=l(3961),p=l(19958),h=l(27798),f=l(11728),b=l(99116),_=l(81560),g=l(67809);function j(){var e,t;let l=(0,o.useRouter)(),{loading:i,subscriptions:j,subscriptionLoading:v}=(0,h.A)(),[y,N]=(0,a.useState)(),[w,k]=(0,a.useState)(),{data:S}=(0,r.useSession)(),[C,A]=(0,a.useState)(!0),[E,M]=(0,a.useState)(null),O=null==S?void 0:S.shopifyAccessToken,I=null!==S&&O,T=u.members_market_access,P=T&&T.trim()||"Active Subscription Only",q=u.market_banner_bg_color,U=(()=>{var e;let t=u.modal_button_link,l="string"==typeof t?t:null==t?void 0:t.url;if(!l)return;let s=null==S||null==(e=S.user)?void 0:e.email;return s?"".concat(l,"#email=").concat(encodeURIComponent(s)):l})(),D=u.filter_collections,R=D.find(e=>"*"===e.key),z=D.map(e=>({title:e.name,path:"/members-market".concat(e.key&&"*"!==e.key?"?collection_name=".concat(e.key):""),active:e.collection_slug===y})),F=l.query.forcemarketopen,{isCurrentlyOpen:L,isBeforeOpenDate:$,isBeforeCloseDate:B,computedStartDate:Y,computedEndDate:V}=(0,f.ym)(u,F),X=new Date(Y),G={startDay:String(X.getUTCDate()),startMonthNumber:String(X.getUTCMonth()+1)},H=null==j||null==(e=j[0])?void 0:e.lastBox,J=(null==H||null==(t=H.tags)?void 0:t.includes("rmc_box_customized"))&&new Date(H.processedAt)>=new Date(Date.now()-1728e6),Q=null==j?void 0:j.some(e=>"active"===e.status||e.has_queued_charges),[W,Z]=(0,a.useState)(!1),[K,ee]=(0,a.useState)("COPY"),et=()=>{let e=null==P?void 0:P.trim();return"All Can Access"===e||("Logged in Only"===e?I:Q)};(0,a.useEffect)(()=>{es("membersModal")||Z(!0)},[]);let el=async e=>{try{await navigator.clipboard.writeText(e),ee("COPIED"),setTimeout(()=>ee("COPY"),2e3)}catch(e){console.error("Failed to copy text:",e)}},es=e=>{let t=document.cookie.split(";");for(let l=0;l<t.length;l++){let s=t[l].trim();if(s.startsWith("".concat(e,"=")))return s.substring(e.length+1)}return null},ea=async e=>{try{let t=await (0,p.rT)(e);if(!t||!t.collection)return;let l={...t,filters:t.filters.filter(e=>"PRICE_RANGE"===e.type)};k(l)}catch(e){}finally{A(!1)}};(0,a.useEffect)(()=>{A(void 0===S||v)},[S,v]),(0,a.useEffect)(()=>
1{if(et()&&L&&!w){let e=new URLSearchParams(window.location.search).get("collection_name")||"",t=D.find(t=>t.key===e.toLowerCase())||R;N(t.collection_slug),ea(t.collection_slug)}},[et]);let er=function(e){let{hours:t,minutes:l,seconds:a,days:r}=e,n=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=e=>String(e).padStart(2,"0");return(0,s.jsxs)("div",{className:"relative h-fit w-fit flex border-bbx-pearl border-2 text-bbx-pearl",children:[(0,s.jsxs)("div",{className:"flex flex-row py-3 px-3 divide-x divide-white font-bold",children:[(0,s.jsxs)("div",{className:"flex flex-col px-2 text-center",children:[(0,s.jsx)("span",{className:"text-2xl",children:i(r)}),(0,s.jsx)("span",{className:"font-normal text-xs",children:"DAYS"})]}),(0,s.jsxs)("div",{className:"flex flex-col px-2 text-center",children:[(0,s.jsx)("span",{className:"text-2xl",children:i(t)}),(0,s.jsx)("span",{className:"font-normal text-xs",children:"HOURS"})]}),(0,s.jsxs)("div",{className:"flex flex-col px-2 text-center",children:[(0,s.jsx)("span",{className:"text-2xl",children:i(l)}),(0,s.jsx)("span",{className:"font-normal text-xs",children:"MINUTES"})]}),(0,s.jsxs)("div",{className:"flex flex-col px-2 text-center",children:[(0,s.jsx)("span",{className:"text-2xl",children:i(a)}),(0,s.jsx)("span",{className:"font-normal text-xs",children:"SECONDS"})]})]}),(0,s.jsx)("h2",{className:"absolute flex top-0 left-1/2 transform -translate-x-1/2 -translate-y-1/2",children:(0,s.jsx)("span",{className:"px-2 whitespace-nowrap ".concat(q?"":"bg-bbx-glow"),style:q?{backgroundColor:q}:void 0,children:n?"Market closes in...":"Market opens in..."})})]})};return C||i?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.bV,{title:"Members Market"}),(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-white/50 pointer-events-none",children:(0,s.jsx)(_.A,{})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.bV,{title:"Members Market"}),et()?L?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("header",{className:"relative py-12 mb-16 ".concat(q?"":"bg-bbx-glow"),style:q?{backgroundColor:q}:void 0,children:(0,s.jsxs)("div",{className:"container flex flex-col md:flex-row place-content-center gap-8 md:gap-16",children:[(0,s.jsxs)("div",{className:"flex flex-row items-start gap-3",children:[(0,s.jsx)(b.A,{className:"h-[58px] w-auto fill-current text-bbx-pearl flex-shrink-0 pt-[2px]"}),(0,s.jsxs)("div",{className:"flex flex-col text-left text-bbx-pearl",style:{textShadow:"0 1px 2px rgba(0,0,0,0.3)"},children:[(0,s.jsx)("h1",{className:"title text-3xl md:text-4xl pb-2",children:(0,f.$7)(u.market_open_subscriber_title[0].text)}),(0,s.jsx)("span",{className:"text-base font-medium",children:(0,f.$7)(u.market_open_subscriber_subtitle[0].text)})]})]}),(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsx)(m.Ay,{date:V,renderer:er})})]})}),w&&(0,s.jsx)(g.A,{filterMenuOptions:z,collectionSlug:y,products:w.products,pageInfo:w.pageInfo,filtersOptions:w.filters,isMemberMarket:!0,quickShopProductIdSelected:E,setQuickShopProductIdSelected:M}),!!(null==u?void 0:u.modal_active)&&("Active Subscription Logged In and Customized"===u.modal_user_type?J:"Active Subscription Logged In"===u.modal_user_type?Q:I)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d.A,{isOpen:W,closeModal:()=>{Z(!1),(e=>{let t=new Date,l=e.match(/^(\d+)(m|h)$/);if(l){let[e,s,a]=l,r=parseInt(s,10)*({m:6e4,h:36e5})[a];t.setTime(t.getTime()+r),document.cookie="membersModal=hide; expires=".concat(t.toUTCString(),"; path=/")}else console.error("Invalid cookie time format. Use '30m', '1h', etc.")})((null==u?void 0:u.modal_cookie_duration)||"30m")},desktopStyle:"floating",children:(0,s.jsxs)("div",{className:"text-center p-20 max-sm:p-10",children:[u.modal_title&&(0,s.jsx)("h1",{className:"title text-3xl md:text-4xl mb-4",children:(0,s.jsx)(x.$,{field:u.modal_title})}),u.modal_description&&(0,s.jsx)("div",{className:"text-xl max-w-[500px] mb-10",children:(0,s.jsx)(x.$,{field:u.modal_description})}),u.modal_promo_code&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"copy-button mt-[12px] h-[45px] border-2 border-dashed flex text-center justify-between flex-auto max-w-[350px] m-auto",children:[(0,s.jsx)("input",{id:"copyvalue",type:"text",readOnly:!0,value:u.modal_promo_code,"aria-label":"Promo code to copy",className:"w-full h-full border-0 outline-none text-center text-[18px] font-bold"}),(0,s.jsx)("button",{type:"button",onClick:()=>el(u.modal_promo_code||""),className:"copybtn pt-[2px] px-[30px] bg-bbx-spark text-white",children:K})]}),(0,s.jsx)("div",{className:"mt-4 italic",children:"Use Promo at Checkout"})]}),U&&u.modal_button_title&&(0,s.jsx)("div",{className:"mt-6 flex justify-center",children:(0,s.jsx)("a",{href:U,target:"_blank",rel:"noopener noreferrer",className:"inline-block bg-bbx-spark text-white font-bold px-8 py-3 hover:bg-bbx-style",children:u.modal_button_title})})]})}),u.modal_quick_open_link_text&&(0,s.jsx)("button",{type:"button",className:"promo-bubble fixed left-3 bottom-3 bg-bbx-spark text-white px-4 py-2 font-bold hover:bg-bbx-style z-10 lg:px-6 lg:py-4 lg:text-lg",onClick:()=>Z(!0),children:u.modal_quick_open_link_text})]})]}):(0,s.jsx)("div",{className:"members-market-bg h-full min-h-[80vh]",children:(0,s.jsx)("header",{className:"flex py-12 mb-16 bg-bbx-glow h-full items-center opacity-95",children:(0,s.jsxs)("div",{className:"flex flex-col container items-center gap-16",children:[(0,s.jsxs)("div",{className:"flex flex-col text-center text-bbx-pearl max-w-[500px]",style:{textShadow:"0 1px 2px rgba(0,0,0,0.3)"},children:[(0,s.jsx)(b.A,{className:"w-10 fill-current mx-auto mb-3"}),(0,s.jsx)("h1",{className:"title text-3xl md:text-4xl pb-2",children:(0,f.$7)(u.market_close_subscriber_title[0].text,G)}),(0,s.jsxs)("p",{className:"text-xl font-medium",children:[(0,s.jsx)("span",{children:(0,f.$7)(u.market_close_subscriber_subtitle[0].text,G)})," ",(0,s.jsx)(c(),{legacyBehavior:!0,href:u.market_close_learn_more_path_link,children:(0,s.jsx)("a",{className:"text-bbx-pearl underline",target:"_blank",children:"Learn more"})})]})]}),B&&(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsx)(m.Ay,{date:Y,renderer:e=>er(e,!1)})})]})})}):(0,s.jsxs)("div",{className:"members-market-bg grid grid-rows-2 md:grid-cols-2 md:grid-rows-1 h-full w-full min-h-[80vh]",children:[(0,s.jsx)("div",{className:"opacity-95 flex bg-bbx-glow justify-center md:justify-end py-4
10 md:pr-[60px]",children:(0,s.jsxs)("div",{className:"flex flex-col place-content-center gap-8",children:[(0,s.jsxs)("div",{className:"flex flex-col text-bbx-pearl items-center md:items-start",style:{textShadow:"0 1px 2px rgba(0,0,0,0.3)"},children:[(0,s.jsx)("h1",{className:"title text-3xl md:text-4xl pb-2",children:u.non_subscriber_title[0].text}),(0,s.jsxs)("ul",{className:"flex flex-col md:items-start gap-2 w-fit font-medium text-xl",children:[u.non_subscriber_subtitle_list.map((e,t)=>(0,s.jsx)("li",{className:"list-item-checkmark-white",children:e.subtitle_item},t)),$&&(0,s.jsx)("li",{className:"underline text-center md:text-left mt-3",children:(0,s.jsx)(c(),{legacyBehavior:!0,href:u.market_close_learn_more_path_link,children:(0,s.jsx)("a",{target:"_blank",children:"Learn more"})})})]})]}),!$&&(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsx)(m.Ay,{date:V,renderer:er})})]})}),(0,s.jsx)("div",{className:"bg-white flex w-full justify-center py-12 md:px-[60px] md:justify-start",children:(0,s.jsxs)("div",{className:"flex flex-col w-fit place-content-center gap-4 md:pl-8",children:[(0,s.jsx)("span",{className:"text-xl flex-wrap max-w-[300px] md:max-w-[400px] text-center md:text-left",children:u.non_subscriber_require_subscription}),(0,s.jsxs)("div",{className:"flex flex-col md:flex-row justify-start gap-4 items-center w-full",children:[(0,s.jsx)(c(),{legacyBehavior:!0,href:"/subscriptions",children:(0,s.jsx)("a",{className:"button button-primary",children:"Purchase a Subscription"})}),!I&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"items-center font-medium",children:"OR"}),(0,s.jsx)(c(),{legacyBehavior:!0,href:"/login?continueUrl=members-market",children:(0,s.jsx)("a",{className:"button button-secondary",children:"Login"})})]})]})]})})]})]})}}},e=>{e.O(0,[9174,9376,5394,8118,9889,4868,7852,7809,636,6593,8792],()=>e(e.s=39799)),_N_E=e.O()}]);
2//# sourceMappingURL=members-market-88351b9f6712ab73.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.