PageSourceSearch

https://shop.merchcentral.com/cdn/shopifycloud/checkout-web/assets/c1/component-DeliveryMacros.BlIT__SB.js

js merchcentral.com collected 2026-09-26 02:35:22 UTC 16,028 bytes, 1 lines download raw bytes

1import{u as e,S as R,e as I,T as L,i as q,l as Le,f as B,q as z,A as se,p as Ie}from"./esnext-vendor.B9Da21W6.js";import{l as E,a_ as ee,k as C,bi as ke,P as ge,ck as Oe,L as Re,bu as ve,Z as F,G as k,m as ne,b as Ae,n as j,o as V,aB as Be,B as x,bI as fe,j as He,aZ as Ne,f as Ge,ac as ze,aw as qe,ah as ae,ax as Fe,I as oe,U as re}from"./hydrate.DZ4YTm7p.js";import{b as J,a as le,C as ce}from"./Choice.DSKmQsTS.js";import{C as je,u as Ve}from"./localization-index.1YNaS8kx.js";import{S as D,B as Ue,T as be,a$ as Qe,ep as $e}from"./addresses-is-address-empty.Bn2lNY_L.js";import{I as We}from"./shop-pay-installments-monorail.BAOukcZ1.js";import{E as K,M as Ye,d as ye,u as Ze}from"./MerchandiseModal.BtS8T15h.js";import{u as U,a as Je,i as Ke,c as Xe,m as en}from"./shipping-methods-consolidated-included.BE_t6ovz.js";import{B as nn,u as _e,E as tn,S as X}from"./EstimatedDeliveryContent.BuJLi-Ww.js";import{B as sn,D as de}from"./BuyWithPrimeOrderTrackingButton.s5XrNJHF.js";import{g as Se,a as Me}from"./shipping-methods-grouping.CtJrOrZZ.js";import{S as an}from"./ShippingMethodSelector.DcVyvGiN.js";import{S as on}from"./ShippingMethodRateLabel.DAtbOh1H.js";import{g as rn}from"./hooks-useReplaceShopPayInHistory.DPpLejwu.js";import"./graphql-PaymentSessionMutation.CAXCwUvV.js";import"./app.DbSrjjlA.js";import"./hooks-useShopPayExternalAppContext.DWwMuRnz.js";import"./Checkbox.DQyvbr9E.js";import"./ShipmentLine.B4fZ0Ud3.js";import"./amazon-constants.DrV5CHv2.js";import"./TextArea.C1mMoZ65.js";import"./IncentiveBadge.DborNHa8.js";import"./PhoneField.C0TeiZrn.js";import"./components-RedirectionNotice.module.CsVdFi0g.js";import"./amazon-pay-useAmazonPayPaymentLine.Ju006AId.js";import"./hooks-useSuppressShopPayModalOnLoad.DFOLDSdS.js";function pe({summary:n}){const{transitText:i,brandedPromise:t,shipmentCountText:s}=n;return!i&&!s?null:e(C,{direction:"inline",gap:"small-300",alignItems:"center",children:[i?e(E,{color:"subdued",children:i}):null,t?e(nn,{brandedPromise:t}):null,i&&s?e(E,{color:"subdued",accessibilityVisibility:"hidden",children:ee}):null,s?e(E,{color:"subdued",children:s}):null]})}function ln({selectedShippingMethod:n}){const{i18n:i}=D(),{deliveryExpectationLines:t}=_e(),{cost:s,costAfterDiscounts:o,hideDiscountedTotalOnShippingSelector:a}=n,r=ke({deliveryMethod:n,localDelivery:n.methodType==="LOCAL"?i.translate("shipping.local_delivery"):void 0}),l=t?.find(m=>m.deliveryStrategyHandle===n.handle);return e(R,{children:[e(C,{direction:"inline",gap:"small-400",children:[e(
1on,{methodTitle:r}),s&&o?e(R,{children:[ee,e(X,{cost:s,costAfterDiscounts:o,inlineDiscount:!0,preDiscountCost:a})]}):null]}),e(tn,{deliveryMethod:n,deliveryExpectationLine:l,paragraphColor:"subdued"})]})}function ue({selectedShippingMethod:n,rollupOpen:i}){const{i18n:t}=D();return i?e(ge,{color:"subdued",children:t.translate("shipping.shipping_method_title")}):e(C,{children:e(ln,{selectedShippingMethod:n})})}function cn({shippingMethods:n,type:i,id:t,displayOnly:s=!1}){const[o]=Oe({type:i,id:t}),{includedMethods:a}=U().value,r=a.size?n.map(d=>a.has(d)?Je(d):d):n,l=s?r[0]:r.find(({handle:d})=>d===o);return l?e(je.Provider,{value:!0,children:e(J,{presentation:"base",children:s?e(ue,{selectedShippingMethod:l}):e(C,{gap:"small-400",paddingBlockStart:"small-400",children:[e(ue,{selectedShippingMethod:l,rollupOpen:!0}),e(an,{type:i,methods:r,id:t,isInSplitCartModal:!0})]})})}):null}const H=2;function dn({merchandise:n,oneTimePurchaseIndex:i,oneTimePurchaseTotalCount:t}){const s=I(!1),o=I(!1),{i18n:a}=D(),r=n.length,{totalQuantity:l,firstFiveQuantity:d}=L(()=>n.reduce((g,f,c)=>{const h=f.quantity??0;return g.totalQuantity+=h,c<H&&(g.firstFiveQuantity+=h),g},{totalQuantity:0,firstFiveQuantity:0}),[n]),m=a.translate("shipping.split_shipping_merchandise_quantity_label_standard",{quantity:l}),y=()=>{if(r>H){s.value=!0;return}o.value=!0};return e(k,{gridAutoFlow:"column",gridAutoColumns:"minmax(auto, max-content)",gridTemplateColumns:"minmax(auto, max-content)",gridTemplateRows:"minmax(0, 1fr)",gap:"small-100",alignItems:"center",alignContent:"center",children:[e(q,{when:o,fallback:e(R,{children:[e(C,{direction:"inline",gap:"small-300",children:n.slice(0,H).map(g=>e(Ye,{merchandiseItem:g},g.stableId))}),e(Re,{onClick:y,children:r>H?a.translate("shipping.split_shipping_merchandise_quantity_label_additional",{quantity:l-d}):a.translate("shipping.split_shipping_merchandise_quantity_label_standard",{quantity:l})})]}),children:e(K,{merchandise:n})}),e(ve,{heading:e(R,{children:[e(ne,{level:1,children:m}),e(Ae,{blockSize:"small-500"}),e(ge,{color:"subdued",children:i&&t?a.translate("shipping.split_shipping_merchandise_shipment_number",{number:i,total:t}):a.translate("order_summary.subscriptions")})]}),open:s.value,onHide:()=>s.value=!1,accessibilityLabel:m,children:[e(F,{}),e(k,{gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",gridAutoRows:"minmax(0, 1fr)",gap:"small-100",padding:"base none none none",children:e(K,{merchandise:n})})]})]})}function pn({merchandise:n,oneTimePurchaseIndex:i,oneTimePurchaseTotalCount:t}){const s=j(),o=Le(n.length>1),a=B(()=>V(s.value.currentDetour)),r=B(()=>o.value&&a.value);return e(q,{when:r,fallback:e(K,{merchandise:n,thumbnailSize:a.value?"small":"base",merchandiseItemGap:a.value?"small-200":"base",thumbnailContentGap:a.value?"small-200":"base"}),children:e(dn,{merchandise:n,oneTimePurchaseIndex:i,oneTimePurchaseTotalCount:t})})}function un({line:n,oneTimePurchaseIndex:i,oneTimePurchaseTotalCount:t,disableBorders:s=!1,heading:o}){const{id:a,type:r,methods:l,targetMerchandiseLines:d}=n,m=Be(d??[]),{currentDetour:y}=j().value,g=V(y);return e(x,{"data-delivery-line-id":a,background:"base",colorLayer:"control",border:s?"none":"base",borderRadius:s?"none":"base",children:[o&&e(R,{children:[e(x,{padding:"base",children:e(ne,{level:3,children:o})}),e(F,{accessibilityRole:"presentation"})]}),e(x,{padding:"base",children:e(k,{gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(auto, max-content) minmax(0, 1fr)",gridAutoRows:"1fr",gap:"small-100",children:[e(pn,{merchandise:m,oneTimePurchaseIndex:i,oneTimePurchaseTotalCount:t}),e(cn,{shippingMethods:l,type:r,id:a,displayOnly:g})]})})]})}function N({lines:n,heading:i,customNode:t,isSingleCard:s=!1,getSequence:o,showExtendedHeading:a=!1,oneTimePurchaseTotalCount:r}){const{i18n:l}=D(),d=n.length,m=j(),y=ye(),{presentsConsolidatedShipping:g}=U().value;if(!d)return null;const f=n.map((c,h)=>{const p=!!t,M=h+1!==n.length,P=s&&(p||M),b=o(c);return e(R,{children:[e(un,{line:c,disableBorders:s,heading:(()=>{if(V(m.value.currentDetour)||y.value)return;const v=a?i:void 0;if(g)return v;const S=l.translate("shipping.split_shipping_shipment_number",{number:b});return v?`${S} ${ee} ${v}`:S})(),oneTimePurchaseIndex:h+1,oneTimePurchaseTotalCount:r},c.id??Ue()),P&&e(F,{})]},c.id)});return t&&f.push(t),e(x,{colorLayer:"control",children:e(k,{gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(auto, max-content)",gridAutoRows:"minmax(auto, max-content)",gap:"small-200",children:s?e(C,{gap:"base",children:e(x,{overflow:"hidden",border:"base",borderRadius:"base",children:f})}):e(C,{gap:"large-200",children:f})})})}
1function he({shippingGroupLines:n,oneTimePurchaseTotalCount:i}){const{i18n:t,shop:{name:s}}=D(),{buyWithPrimeLines:o,shipsNowLines:a,shipsLaterLines:r}=L(()=>Se(n),[n]),l=L(()=>Me(n),[n]),d=L(()=>{let h=[...o,...a,...r];return l&&(h=[...h,...l.reduce((p,[,M])=>[...p,...M],[])]),h},[o,a,r,l]),m=z(h=>d.indexOf(h)+1,[d]),y=L(()=>o.length>0?t.translate("shipping.split_shipping_shipped_by_shop",{shop_name:s}):t.translate("shipping.pre_order_ships_now"),[o.length,t,s]),g=j(),f=B(()=>V(g.value.currentDetour)),c=r.length>0||(l?l?.length>0:!1);return e(C,{gap:"large-200",children:[o.length>0&&e(N,{lines:o,getSequence:m,heading:t.translate("split_shipping.shipped_by_amazon_prime"),oneTimePurchaseTotalCount:i,customNode:e(q,{when:f,children:e(x,{padding:"small-100 base",children:e(sn,{})})}),isSingleCard:!0,showExtendedHeading:c}),a.length>0&&e(N,{lines:a,getSequence:m,heading:y,oneTimePurchaseTotalCount:i,showExtendedHeading:c}),r.length>0&&e(N,{lines:r,getSequence:m,heading:t.translate("shipping.pre_order_ships_later"),oneTimePurchaseTotalCount:i,showExtendedHeading:c}),l?.map(([h,p])=>p.length>0&&e(N,{lines:p,getSequence:m,heading:t.translate("shipping.pre_order_ships_date",{date:t.formatDate(new Date(h),{timeZone:"UTC",month:"long",day:"numeric",year:"numeric"})}),oneTimePurchaseTotalCount:i,showExtendedHeading:c},h))]})}const G="more-shipping-options-modal";function hn({deliveryLines:n,openAtDeliveryLineId:i,onOpen:t,onClose:s}){const{i18n:o}=D(),a=o.translate("shipping.shipping_method_title"),r=fe(),l=se(),d=U(),{total:m,presentsConsolidatedShipping:y}=d.value,g=I(!1),f=I(""),c=B(()=>{const{total:v,presentsConsolidatedShipping:S}=d.value;return!S||!v?null:o.translate("order_summary.shipping_total_updated_label_with_price",{totalPrice:o.formatCurrency(v.amount,{currency:v.currencyCode,form:"name"})})}),h=se(null);Ie(()=>{if(!g.value){h.current=null,f.value="";return}const v=c.value;if(!v){f.value="";return}const S=h.current;h.current=v,S&&v!==S&&(f.value=v)});const p=G,M=z(()=>{if(!i)return;Array.from(document.getElementById(p)?.querySelectorAll("[data-delivery-line-id]")??[]).find(S=>S.dataset.deliveryLineId===i)?.scrollIntoView({block:"start",behavior:"instant"})},[i,p]),P=()=>{h.current=c.peek(),f.value="",g.value=!0,r("moreShippingOptions",{timestamp:new Date,subEvent:"modalOpen"}),t?.()},b=async()=>{await l.current,r("moreShippingOptions",{timestamp:new Date,subEvent:"modalSave"})},_=async()=>{g.value=!1,l.current=s(),await l.current,r("moreShippingOptions",{timestamp:new Date,subEvent:"modalClose"})},T=e(He,{variant:"primary",inlineSize:"fill",command:"--hide",commandFor:p,onClick:b,children:o.translate("payment.saved_credit_cards_modal.done")});return e(ve,{heading:a,onShow:P,onAfterShow:M,onHide:_,id:p,footer:y?e(x,{background:"base",children:[e(F,{}),e(x,{paddingBlock:"base",paddingInline:"large-200",children:e(C,{gap:"base",children:[m&&e(k,{gridTemplateColumns:"1fr auto",gap:"base",children:[e(E,{type:"strong",children:o.translate("order_summary.multiple_shipping_lines_label")}),e(E,{type:"strong",translate:!1,children:o.formatCurrency(m.amount,{currency:m.currencyCode})})]}),e(x,{accessibilityVisibility:"exclusive",accessibilityRole:"status",children:f.value}),T]})})]}):void 0,padding:y?"none":"base",children:y?e(x,{paddingBlockStart:"base",paddingBlockEnd:"large-200",paddingInline:"large-200",children:e(he,{shippingGroupLines:n})}):e(C,{gap:"large-200",padding:"none none large-200 none",children:[e(he,{shippingGroupLines:n}),T]})})}function mn(n,i,t){const{shop:s,i18n:o}=D(),{deliveryMacros:a}=be(),r=Ne(),{deliveryExpectationLines:l}=_e(),d=new Map,m=a.value;if(!s.marketDrivenShippingEnabled||!m?.length)return d;const{shipsLaterLines:y}=Se(n),g=Me(n),f=!!(y.length||g?.length),c=m.map(p=>{const M=new Set(Object.values(p.deliveryMethodHandles)),b=n.map(_=>({line:_,method:_.methods.find(({handle:T})=>M.has(T))})).filter(Ke);return{macro:p,resolvedMethods:b.map(({method:_})=>_).filter(_=>!!_),count:Xe(b).length}}),h=t>0?t===1:(c.find(({macro:p})=>p.id===i)??c[0]).count===1;for(const{macro:p,resolvedMethods:M,count:P}of c){if(P>1&&p.id===i)continue;
1const b=rn({selectedMethods:M,deliveryExpectationLines:l??[],deliveryPromiseText:p.deliveryPromisePresentmentTitle?.short}),_=en(M),T=_?r(_)??void 0:void 0,v=gn({shopPromiseSummary:b,isPreOrder:f,formattedTimeInTransit:T,fallbackText:p.deliveryPromisePresentmentTitle?.long}),S=h&&P>1?o.translate("shipping.split_shipping_multiple_shipment_quantity_label",{quantity:P}):void 0;d.set(p.id,{...v&&{transitText:v},...b?.brandedPromise&&{brandedPromise:b.brandedPromise},...S&&{shipmentCountText:S}})}return d}function gn({shopPromiseSummary:n,isPreOrder:i,formattedTimeInTransit:t,fallbackText:s}){if(n)return n.deliveryPromiseText;if(!i)return t??s}const me={border:"none",background:"transparent",backgroundSelected:"base"};function Fn({deliveryLines:n}){const{checkout:i,i18n:t}=D(),{negotiate:s}=Ge(),{deliveryMacros:o}=be(),a=I(!1),r=o.value,l=I(),d=I(),{selectedMacro:m,setSelectedMacro:y}=ze(),g=m?.id,f=fe(),c=Ve(),h=B(()=>Qe({checkout:i})),p=n.every(u=>u.methods.length===1),M=a.value&&!m,P=ye(),b=U(),_=mn(n,g,b.value.groups.length),T=b.value.groups.length,v=T>0?T:n.length,S=h.value||P.value,Q=n.length>=$e&&!c&&(S||v>1),te=d.value??Q,$=z(()=>{d.value===void 0&&(d.value=Q)},[d,Q]),{customizationsBefore:Ce,customizationsAfter:Te}=Ze({targeted:!0,hasMultipleDeliveryGroups:!0}).value,xe=()=>(a.value=!0,s({include:["deliveryNext"],onComplete:()=>{a.value=!1}})),Pe=L(()=>g?[g]:[],[g]),we=z(async([u])=>{u&&($(),await y(u),f("deliveryMacroInteraction",{timestamp:new Date,subEvent:"delivery_macros_input_change"}))},[f,$,y]),W=u=>{$(),l.value=u?n.find(w=>w.methods.includes(u))?.id:void 0},ie=L(()=>({groupType:qe("ONE_TIME_PURCHASE"),includeDeliverySelectionGroups:!p}),[p]);if(!r?.length)return null;let Y;if(p){const[u]=r,w=_.get(u.id),O=w&&(w.transitText||w.shipmentCountText)?e(pe,{summary:w}):void 0;Y=T===1?e(J,{...c?me:{},children:e(le,{variant:"block",name:"delivery-macros",values:[u.id],hideRadioControl:!0,children:e(ce,{value:u.id,secondaryContent:u.cost.amount!==0&&e(X,{cost:u.cost,costAfterDiscounts:u.costAfterDiscounts,styleOverrides:{freeTextLetterCase:"uppercase",costSpacing:"none"}}),details:O,children:u.title})})}):e(x,{background:"base",colorLayer:"control",border:"base",borderRadius:"base",padding:"none",children:e(de,{selectedDeliveryMethodHandles:Object.values(u.deliveryMethodHandles),deliveryLines:n,choiceListContext:!1,isSharedRate:u.isSharedRate,shipmentGroups:b.value.groups,includedMethods:b.value.includedMethods,shipmentCommandFor:G,onShipmentClick:W})})}else Y=e(J,{...c?me:{},children:e(le,{variant:"block",name:"delivery-macros",values:Pe,onChange:we,blockFooter:e(k,{gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",children:e(Fe,{padding:c?"base none small-300 base":"base",borderRadius:"none none base base",onClick:W,commandFor:G,children:e(k,{justifyItems:c?"start":"center",justifyContent:c?"start":"center",alignItems:"center",alignContent:"center",children:e(C,{direction:"inline",gap:"small-100",children:[c&&e(oe,{type:"plus",tone:"accent"}),e(E,{type:c?"generic":"strong",tone:"accent",children:t.translate("shipping.split_shipping_more_shipping_options")})]})})})}),children:r.map(u=>{const{id:w,title:O,cost:Z,costAfterDiscounts:Ee}=u,A=M?void 0:_.get(w),De=A?[O,A.transitText,A.shipmentCountText].filter(Boolean).join(", "):O;return e(ce,{value:w,selectedContent:e(de,{selectedDeliveryMethodHandles:Object.values(u.deliveryMethodHandles),deliveryLines:n,isSharedRate:u.isSharedRate,macroTitle:u.title,shipmentGroups:b.value.groups,shipmentCommandFor:G,onShipmentClick:W,includedMethods:b.value.includedMethods}),selectedContentPadding:"none",secondaryContent:M?e(ae,{inlineSize:"5ch"}):Z.amount!==0&&e(X,{cost:Z,costAfterDiscounts:Ee,styleOverrides:{freeTextLetterCase:"uppercase",costSpacing:"none"}}),accessibilityLabel:De,children:M?e(ae,{inlineSize:"12ch",children:O}):e(C,{children:[e(E,{children:O}),A?e(pe,{summary:A}):null]})},w)})})});return e(We,{impressionType:"delivery_macros",impressionFeatures:r.map(({id:u})=>u),children:e(C,{gap:"base",paddingBlockStart:!c&&!te?"small-100":"none",children:[te&&e(C,{direction:"inline",alignItems:"center",gap:"small-400",children:[e(
1oe,{type:"truck"}),e(E,{color:"subdued",children:S?t.translate("shipping.split_shipping_multiple_shipment_notice"):t.translate("shipping.split_shipping_shipment_count_notice_one_time_purchase",{count:v})})]}),e(q,{when:h,children:e(ne,{level:3,children:t.translate("shipping.shipping_method_first_shipment_group_title.other")})}),e(re,{customizations:Ce,options:ie}),Y,e(hn,{deliveryLines:n,openAtDeliveryLineId:l.value,onClose:xe}),e(re,{customizations:Te,options:ie})]})})}export{me as DELIVERY_MACRO_VAULTED_STYLE_OVERRIDES,Fn 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.