PageSourceSearch

https://www.youngla.com/cdn/shopifycloud/checkout-web/assets/c1/page-StockProblemsModal.CxGt62PK.js

js youngla.com collected 2026-09-25 18:58:12 UTC 5,188 bytes, 1 lines download raw bytes

1import{u as n,T as w,k as q,q as g,h as k,f as K,i as W}from"./esnext-vendor.B9Da21W6.js";import{bp as Q,B as T,G as Y,k as R,l as F,j as G,f as N,bq as $,n as V,br as X,bs as Z,A as ee,bt as te,K as ne,bu as ae}from"./hydrate.DZ4YTm7p.js";import{S as h,by as L,a4 as re,bc as oe,T as ie,bz as se,an as le}from"./addresses-is-address-empty.Bn2lNY_L.js";import{u as ce}from"./stock-problems-useStockProblemsState.C_MqmPm-.js";import{U as de}from"./embed-deferred.B7xD-_a4.js";import{u as ue}from"./graphql-PaymentSessionMutation.CAXCwUvV.js";import{u as me,S as B}from"./stopwatch.CfKlh48v.js";import{S as pe}from"./StockProblems-StockProblemsLineItemList.BhXfh82f.js";import"./app.DbSrjjlA.js";import"./hooks-useShopPayExternalAppContext.DWwMuRnz.js";import"./hooks-useReplaceShopPayInHistory.DPpLejwu.js";function z({progressing:e,onClick:t,cartEmpty:r,inlineSize:a}){const{i18n:o,embed:d}=h(),s=r&&!L(d?.embedder);return n(G,{variant:"primary",disabled:e,loading:e,onClick:t,inlineSize:a,children:s?o.translate("stock.return_to_store_label"):o.translate("stock.continue_cta_label")})}function be({progressing:e,onSecondaryClick:t}){const{i18n:r,url:a,observability:o}=h();return n(G,{onClick:async()=>{try{await t()}catch(s){o.leaveErrorBreadcrumb("Error negotiating before returning to cart",{error:s})}finally{window.location.replace(a.cart())}},variant:"plain",disabled:e,children:n(R,{direction:"inline",gap:"small-200",alignItems:"center",children:n(F,{children:r.translate("general.back_to_cart")})})})}function ge(e){const{shop:t,embed:r}=h(),{isAppLayout:a}=Q(),o=L(r?.embedder);if(!t.hasStorefront&&e.cartEmpty&&!o)return null;const{primary:d,secondary:s}=he(t.hasStorefront,e,a,o);return n(Y,{alignItems:"center",alignContent:"center",gridTemplateRows:"minmax(auto, max-content)",gridAutoRows:"minmax(auto, max-content)",gap:"large-300",...o?{gridTemplateColumns:"1fr",inlineSize:"100%"}:{gridTemplateColumns:"@media (inline-size >= extraSmall) 'minmax(auto, max-content) minmax(auto, max-content)', none",justifyContent:"@media (inline-size >= extraSmall) end, ''",justifyItems:"@media (inline-size >= extraSmall) end, ''"},children:[n(T,{display:"@media (inline-size >= extraSmall) auto, none",children:s}),d,n(T,{display:"@media (inline-size >= extraSmall) none, auto",inlineAlignment:"center",children:s})]})}function he(e,t,r,a){return e?{primary:t.cartEmpty&&r&&!a?null:n(z,{...t,inlineSize:a?"fill":void 0}),secondary:t.cartEmpty||a||r&&!t.cartEmpty?null:n(be,{...t})}:!e&&!t.cartEmpty?{primary:n(z,{...t,inlineSize:a?"fill":void 0})}:{}}function ye({lineItems:e,showLineItems:t=!0,cartEmpty:r,type:a,subtitle:o}){const d=re(),{value:s}=d.merchandiseLines,p=oe("merchandiseLines").value,{progress:b,progressing:P}=N(),u=ie().merchandiseLines,f=$(),{observability:_,router:x,embed:v}=h(),{currentDetour:A}=V().value,M=w(()=>s?.lines??[],[s]),[C,U]=q(p);ue("stock_problems"),me({stage:C?B.Loading:B.Complete,id:"StockProblems"});const D=r&&L(v?.embedder),E=g(l=>{const i=u.value;u.value=i.filter(({stableId:y})=>!l.includes(y))},[u]),J=g(()=>{se(v,de)},[v]),I=w(()=>M.reduce((l,i)=>({...l,[i.stableId]:i}),{}),[M]),S=g(({removeUnavailableMerchandise:l=!1}={})=>{const i=u.value,y=i.flatMap(m=>{const c=I[m.stableId];return l&&(!c||c.quantity===0)?[]:!c||c.quantity===0?[m]:m.quantity===c.quantity&&m.totalPrice===c.totalPrice?[m]:[{...m,quantity:c.quantity,totalPrice:c.totalPrice}]});y.length===i.length&&y.every((m,c)=>m===i[c])||(u.value=y)},[I,u]),j=g(async()=>{const l=e.filter(({problem:i})=>X(i.type)).map(({line:i})=>i.stableId);l.length&&E(l),S({removeUnavailableMerchandise:!0}),_.log("stock_problems_actions_submitted","Stock problems actions submitted",{unshippableMerchandiseIds:JSON.stringify(l),currentDetour:JSON.stringify(A),routerCurrentUrl:x.currentUrl.value.normalizedPath}),await b("checkout-stock-problems-submit")},[A,e,_,b,E,x,S]),O=Z(),H=g(async()=>{await O(e)},[O,e]);return k(function(){S()},[M,S]),k(()=>{p||(U(!1),f.notify({checkout_in_progress:!1}))},[p,C,f]),n(te,{message:o,errorType:ee.InventoryError,children:n(R,{gap:"large-200",children:[n(F,{children:o}),t&&e.length>0?n(pe,{lineItems:e,loading:C,type:a}):null,n(ge,{cartEmpty:r,progressing:P.value,onClick:D?J:j,onSecondaryClick:H})]})})}function Ie(){const{observability:e,checkout:{wallets:t}}=h(),{canBeDismissed:r,...a}=ce(),{progress:o}=N(),[d,s]=q(!0),p=K(()=>t.activeSession.value?.wallet!=="GOOGLE_PAY"),{checkoutProtocolModalEventSignal:b}
1=le(),P=g(()=>{o("stock-problems-modal-close",()=>{s(!1)})},[o]),u=r?{blocking:!1,onHide:P}:{blocking:!0};k(()=>()=>{b.value="none"},[b]);const f=()=>{e.leaveErrorBreadcrumb("Stock problems modal opened",{type:a.type}),b.value="stockProblems"};return n(W,{when:p,children:[n(fe,{state:a}),n(ne,{section:"stock-problems",children:n(ae,{id:"stock-problems-modal",open:d,heading:a.title,size:"large",onShow:f,...u,children:n(ye,{...a})})})]})}function fe({state:e}){const{observability:t}=h();return k(()=>{e.lineItems.length!==0&&t.leaveErrorBreadcrumb("Displaying stock problems modal",{type:e.type,lineItems:e.lineItems.map(r=>({stableId:r.line.stableId,problem:r.problem.type}))})},[t,e.lineItems,e.type]),null}export{Ie as default};

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.