1"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[7491],{26647(e,t,n){n.d(t,{A:()=>f});var r=n(64180),o=n(18801),i=n(77810),a=n(17015),l=n(16914),c=n(75826),s=n.n(c),u=n(67220),d=n(34692);const p=["dialogTitle","confirmationMessage","confirmationMessageValues","primaryActionLabel","alternateActionLabel","hideAlternateAction","onPrimaryAction","onAlternateAction"],m=e=>{let{dialogTitle:t=u.Gz.dialogTitle,confirmationMessage:n=u.Gz.confirmationMessage,confirmationMessageValues:c,primaryActionLabel:s=u.Gz.primaryActionLabel,alternateActionLabel:m=u.Gz.alternateActionLabel,hideAlternateAction:f=!1,onPrimaryAction:y=a.lQ,onAlternateAction:b=a.lQ}=e,g=(0,o.A)(e,p);const{formatMessage:A}=(0,d.A)(),v=()=>{b(),g.onClose()};return i.createElement(l.Lt,(0,r.A)({isOpen:g.isOpen,isCentered:!0,onClose:v},g),i.createElement(l.LA,null),i.createElement(l.EO,null,i.createElement(l.wd,null,A(t)),i.createElement(l.vZ,null,i.createElement(l.EY,null,A(n,c))),i.createElement(l.ck,null,f?null:i.createElement(l.$n,{variant:"ghost",mr:3,"aria-label":A(g.alternateActionAriaLabel||m),onClick:v},A(m)),i.createElement(l.$n,{variant:"solid",onClick:()=>{y(),g.onClose()},"aria-label":A(g.primaryActionAriaLabel||s)},A(s)))))};m.propTypes={isOpen:s().bool.isRequired,onOpen:s().func.isRequired,onClose:s().func.isRequired,dialogTitle:s().object,confirmationMessage:s().object,confirmationMessageValues:s().object,primaryActionLabel:s().object,primaryActionAriaLabel:s().object,alternateActionLabel:s().object,alternateActionAriaLabel:s().object,onPrimaryAction:s().func,onAlternateAction:s().func,hideAlternateAction:s().bool};const f=m},71878(e,t,n){n.d(t,{A:()=>g});var r=n(64180),o=n(28407),i=n(10939),a=n(77810),l=n(75826),c=n.n(l),s=n(90031),u=n(73448),d=n(26647),p=n(16914),m=n(17015);function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach(function(t){(0,i.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}const b=({productIds:e=[],productItems:t=[],handleUnavailableProducts:n=m.lQ})=>{const i=(0,a.useRef)(null),l=e.length?e:t.map(e=>e.productId),c=[...new Set(t.map(e=>e.inventoryId).filter(Boolean))].join(",");(0,s.useProducts)({parameters:y({ids:null==l?void 0:l.join(","),allImages:!0},c?{inventoryIds:c}:{})},{enabled:(null==l?void 0:l.length)>0,onSuccess:e=>{var n;const r=[],o=[];null===(n=e.data)||void 0===n||n.forEach(({id:e,inventory:n,inventories:i})=>{if(r.push(e),t.length){const r=t.find(t=>t.productId===e),a=!(null==r||!r.type),l=(null==i?void 0:i.find(e=>e.id===r.inventoryId))||n;a||null!=l&&l.orderable&&!(null!=l&&l.orderable&&(null==r?void 0:r.quantity)>l.stockLevel)||o.push(e)}});const a=l.filter(e=>!r.includes(e)||o.includes(e));i.current=a}});const f=(0,p.j1)();return(0,a.useEffect)(()=>{var e;(null===(e=i.current)||void 0===e?void 0:e.length)>0&&f.onOpen()},[i.current]),a.createElement(d.A,(0,r.A)({"data-testid":"unavailable-product-modal",closeOnEsc:!1,closeOnOverlayClick:!1},u.F1,{hideAlternateAction:!0,onPrimaryAction:(0,o.A)(function*(){yield n(i.current),i.current=null,f.onClose()}),onAlternateAction:()=>{}},f))};b.propTypes={productItems:c().array,productIds:c().array,handleUnavailableProducts:c().func};const g=b},77491(e,t,n){n.r(t),n.d(t,{default:()=>w});var r=n(28407),o=n(10939),i=n(77810),a=n(34692),l=n(41863),c=n(16914),s=n(90031),u=n(7711),d=n(28258),p=n(54851),m=n(64180),f=n(75826),y=n.n(f),b=n(25635);const g=({heading:e,text:t,icon:n,buttonText:r,buttonProps:o,onButtonClick:a})=>i.createElement(c.BJ,{spacing:2,py:12,px:4,alignItems:"center",borderRadius:"base",background:"gray.50"},i.createElement(c.az,null,n),i.createElement(c.BJ,{spacing:6,alignItems:"center"},i.createElement(c.az,null,i.createElement(c.EY,{align:"center",fontSize:"lg",fontWeight:"bold"},e),i.createElement(c.EY,{align:"center",fontSize:"md",color:"gray.700"},t)),i.createElement(c.$n,(0,m.A)({onClick:a,leftIcon:i.createElement(b.c1,null)},o),r)));g.propTypes={heading:y().string,text:y().string,buttonText:y().string,icon:y().any,buttonProps:y().object,onButtonClick:y().func};const A=g;var v=n(92895),h=n(66732),E=n(47968),O=n(73448),I=n(60309),j=n(71878);function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function L(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
1t%2?P(Object(n),!0).forEach(function(t){(0,o.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}const w=()=>{var e,t;const n=(0,u.A)(),{formatMessage:o}=(0,a.A)(),m=(0,d.dj)(),f=(0,i.useRef)();(0,i.useEffect)(()=>{var e;null==f||null===(e=f.current)||void 0===e||e.focus()},[]);const[y,g]=(0,i.useState)(void 0),[P,w]=(0,i.useState)(!1),{data:C,isLoading:S}=(0,p.T)(),x=null==C||null===(e=C.customerProductListItems)||void 0===e?void 0:e.map(e=>e.productId),{data:k,isLoading:_}=(0,s.useProducts)({parameters:{ids:null==x?void 0:x.join(","),allImages:!0,perPricebook:!0}},{enabled:(null==x?void 0:x.length)>0}),D=null==C||null===(t=C.customerProductListItems)||void 0===t?void 0:t.reduce((e,t)=>{var n;const r=null==k||null===(n=k.data)||void 0===n?void 0:n.find(e=>e.id===t.productId);return L(L({},e),{},{[t.productId]:L(L({},t),{},{product:r})})},{}),M=(0,s.useShopperCustomersMutation)("updateCustomerProductListItem"),z=(0,s.useShopperCustomersMutation)("deleteCustomerProductListItem"),{data:T}=(0,I.J)(),B=function(){var e=(0,r.A)(function*(e,t){w(!0),g(e);try{yield t}finally{w(!1),g(void 0)}});return function(t,n){return e.apply(this,arguments)}}(),R=function(){var e=(0,r.A)(function*(e){e.length&&(yield Promise.all(e.map(function(){var e=(0,r.A)(function*(e){const t=null==D?void 0:D.find(t=>t.productId.toString()===e.toString()),n={customerId:T.customerId,itemId:null==t?void 0:t.id,listId:null==C?void 0:C.id};yield z.mutateAsync({parameters:n})});return function(t){return e.apply(this,arguments)}}())))});return function(t){return e.apply(this,arguments)}}(),q=function(){var e=(0,r.A)(function*(e,t){let n=!1;g(t.productId);const r=L(L({},t),{},{quantity:parseInt(e)});delete r.product;const i={customerId:T.customerId,itemId:t.id,listId:null==C?void 0:C.id},a=parseInt(e)>0?M.mutateAsync({body:r,parameters:i}):z.mutateAsync({parameters:i});try{yield a,n=!0,g(void 0)}catch(e){m({title:o(O.gS),status:"error"})}return n});return function(t,n){return e.apply(this,arguments)}}(),J=Object.keys(D??{}).length>0,U=J?_:S;return i.createElement(c.BJ,{spacing:4,"data-testid":"account-wishlist-page"},i.createElement(c.DZ,{as:"h1",fontSize:"2xl",tabIndex:"0",ref:f},i.createElement(l.A,{defaultMessage:[{type:0,value:"Wishlist"}],id:"account_wishlist.title.wishlist"})),U&&i.createElement(c.az,{"data-testid":"sf-wishlist-skeleton"},new Array(3).fill(0).map((e,t)=>i.createElement(c.az,{key:t,p:[4,6],my:4,border:"1px solid",borderColor:"gray.100",borderRadius:"base"},i.createElement(c.so,{width:"full",align:"flex-start"},i.createElement(c.EA,{boxSize:["88px",36],mr:4}),i.createElement(c.BJ,{spacing:2},i.createElement(c.EA,{h:"20px",w:"112px"}),i.createElement(c.EA,{h:"20px",w:"84px"}),i.createElement(c.EA,{h:"20px",w:"140px"})))))),!U&&!J&&i.createElement(A,{"data-testid":"empty-wishlist",icon:i.createElement(b.C3,{boxSize:8}),heading:o({defaultMessage:[{type:0,value:"No Wishlist Items"}],id:"account_wishlist.heading.no_wishlist"}),text:o({defaultMessage:[{type:0,value:"Continue shopping and add items to your wishlist."}],id:"account_wishlist.description.continue_shopping"}),buttonText:o({defaultMessage:[{type:0,value:"Continue Shopping"}],id:"account_wishlist.button.continue_shopping"}),buttonProps:{leftIcon:void 0},onButtonClick:()=>n("/")}),!U&&D&&Object.keys(D).map(e=>{const t=D[e];return i.createElement(v.A,{key:t.id,product:L(L({},t.product),{},{quantity:t.quantity}),showLoading:(M.isLoading||z.isLoading||P)&&y===t.productId,primaryAction:i.createElement(h.A,null),onItemQuantityChange:e=>q(e,t),secondaryActions:i.createElement(E.A,{productListItemId:t.id,productName:t.product.name,focusElementOnRemove:f,onClick:B})})}),i.createElement(j.A,{productItems:null==C?void 0:C.customerProductListItems,handleUnavailableProducts:R}))}}}]);
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.