PageSourceSearch

https://lambsivy.com/cdn/shopifycloud/checkout-web/assets/c1/AdminPreviewBar.DxWbZanu.js

js lambsivy.com collected 2026-09-25 18:35:32 UTC 7,781 bytes, 1 lines download raw bytes

1import{k as B,A as g,h as k,u as o,g as a,q as b}from"./esnext-vendor.B9Da21W6.js";import{S as m,H as _,cl as y,cm as R}from"./addresses-is-address-empty.Bn2lNY_L.js";import{z as T,F as C}from"./hydrate.DZ4YTm7p.js";import"./app.DbSrjjlA.js";import"./graphql-PaymentSessionMutation.CAXCwUvV.js";import"./hooks-useShopPayExternalAppContext.DWwMuRnz.js";import"./hooks-useReplaceShopPayInHistory.DPpLejwu.js";const A="_5VDNf",E="QQl0K",S="b55Os",D="xUDNs",L="pma1e",H="PbCAx",F="ncLsx",$="pANtK",M="Lv27R",O="QrVyj",U="_8g9jX",V="kzg8Q",W="fRev4",G="_23DNR",z="PPsU1",K="_4eXdm",Q="jh8dr",j="VFBYy",X="qiaij",Z="hrjCV",q="TGwcC",J="AQ2H8",x="Ss3bX",Y="_6i8Nz",ee="LKghr",te="_4lxAm",ne="_32tkw",oe="eGnSr",re="FKJsD",ae="uQ3ob",ie="bf6R7",se="TsH35",ce="LJWx1",le="fiXQ9",ue="uTDjH",de="D8Sdn",e={PreviewBarMain:A,PreviewBarStart:E,PreviewBarInfo:S,ConfigurationName:D,TwoRowLayout:L,RolloutName:H,VisuallyHidden:F,ShopifyGlyph:$,RocketIcon:M,RolloutRow:O,PreviewIcon:U,MenuHorizontalIcon:V,HideIcon:W,ExitIcon:G,InlineBlock:z,Space1:K,Space2:Q,Focus:j,ActionWrap:X,PreviewBar:Z,EditButton:q,MoreButton:J,Popover:x,PopoverContent:Y,PopoverOpen:ee,ActionList:te,ActionListItemButton:ne,IconButton:oe,Badge:re,BadgeActive:ae,BadgeDraft:ie,BadgeLaunches:se,BadgePaused:ce,BadgeTraffic:le,BadgeTrafficZero:ue,BadgeDot:de},fe=C("ProfilePreviewActionMenu");function pe({onHideBar:t,onExitPreview:n}){const{i18n:r}=m(),[i,s]=B(!1),l=g(null),d=g(null),c=T(void 0,fe);return k(()=>{if(!i)return;function u(p){l.current&&!l.current.contains(p.target)&&s(!1)}function f(p){p.key==="Escape"&&(s(!1),d.current?.focus())}return document.addEventListener("mousedown",u),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",f)}},[i]),o("div",{ref:l,className:a({[e.PopoverOpen]:i},e.Popover),children:[o("button",{ref:d,className:a(e.MoreButton,e.Focus),onClick:()=>s(u=>!u),"aria-label":r.translate("profile_preview_bar.actions_button"),"aria-expanded":i,"aria-haspopup":"true","aria-controls":c,type:"button",children:o("span",{className:a(e.PreviewIcon,e.MenuHorizontalIcon),"aria-hidden":"true"})}),o("div",{id:c,className:a(e.PopoverContent,e.ActionList),children:[o("button",{className:a(e.ActionListItemButton,e.Focus),onClick:()=>{s(!1),t()},type:"button",children:[o("span",{className:a(e.PreviewIcon,e.HideIcon),"aria-hidden":"true"}),r.translate("profile_preview_bar.hide_bar")]}),o("button",{className:a(e.ActionListItemButton,e.Focus),onClick:()=>{s(!1),n()},type:"button",children:[o("span",{className:a(e.PreviewIcon,e.ExitIcon),"aria-hidden":"true"}),r.translate("profile_preview_bar.exit_preview")]})]})]})}function N({badge:t}){const{i18n:n}=m();switch(t.kind){case"active":return o("span",{className:a(e.Badge,e.BadgeActive),children:n.translate("profile_preview_bar.badge_active")});case"draft":return o("span",{className:a(e.Badge,e.BadgeDraft),children:n.translate("profile_preview_bar.badge_draft")});case"paused":return o("span",{className:a(e.Badge,e.BadgePaused),children:n.translate("profile_preview_bar.badge_paused")});case"launches":{const r=n.formatDate(new Date(t.startDate),{month:"short",day:"numeric",timeZone:"UTC"});return o("span",{className:a(e.Badge,e.BadgeLaunches),children:n.translate("profile_preview_bar.badge_launches",{date:r})})}case"scheduled":return o("span",{className:a(e.Badge,e.BadgeLaunches),children:n.translate("profile_preview_bar.badge_scheduled")});case"traffic":{const i=n.numberFormatter({style:"percent",minimumFractionDigits:0,maximumFractionDigits:0}).format(t.percentage/100);return o("span",{className:a(e.Badge,e.BadgeTraffic,{[e.BadgeTrafficZero]:t.percentage===0}),children:[o("span",{className:e.BadgeDot,"aria-hidden":"true"}),n.translate("profile_preview_bar.badge_traffic",{percentage:i})]})}}}function me({configurationName:t,rolloutName:n,badge:r}){return n?o(ve,{configurationName:t,rolloutName:n,badge:r}):o(he,{configurationName:t,badge:r})}function ve({configurationName:t,rolloutName:n,badge:r}){const{i18n:i}=m();return o("div",{className:e.TwoRowLayout,children:[o("p",{className:e.ConfigurationName,children:t}),o("div",{className:e.RolloutRow,children:[o("span",{className:e.RocketIcon,"aria-hidden":"true"}),o("span",{className:e.VisuallyHidden,children:i.translate("profile_preview_bar.rollout_label")}),o("span",{className:e.RolloutName,children:n}),r&&o(N,{badge:r})]})]})}function he({configurationName:t,badge:n}){return o("div",{className:a(e.InlineBlock,e.Space2),children:[o("p",{className:e.ConfigurationName,children:t}),n&&o(N,{badge:n})]})}function we({configurationName:t,rolloutName:n,closePreview:r,checkoutEditorUrl:i,adminUrl:s,isPreviewingCheckoutScript:l,badge:d}){const[c,u]=B(!1),{i18n:f}=m();if(c)return null;const p=a(e.PreviewBarMain,e.PreviewBar),h=i&&!l;return o("div",{className:p,children:[o("div",{className:a(e.InlineBlock,e.PreviewBarStart),children:[o("button",{className:a(e.IconButton,e.Focus),"aria-label":f.translate("profile_preview_bar.navigate_to_admin"),onClick:()=>{s&&window.parent.open(s,"_self")},type:"button",children:o("span",{className:e.ShopifyGlyph,"aria-hidden":"true"})}),o("div",{className:e.PreviewBarInfo,children:o(me,{configurationName:t,rolloutName:n,badge:d})})]}),o("div",{className:a(e.ActionWrap,e.InlineBlock,e.Space1),children:[o(pe,{onHideBar:()=>u(!0),onExitPreview:r}),h&&o("button",{className:a(e.EditButton,e.Focus),onClick:()=>window.parent.open(i),type:"button",children:f.translate("profile_preview_bar.edit")})]})]})}
1const ge="settings/checkout/editor",Pe="profile_preview_info",Be="profile_preview_token";function _e(t){const{shop:{configurationPreviewContext:n}}=m();if(n!=="no-preview")return Ne(n,t)}function Ne(t,n){return{configurationName:t.configurationName,rolloutName:t.rollout?.name,isPublished:t.isPublished,adminUrl:t.adminUrl,badge:Ie(t),previewToken:n.searchParams.get(Be)??void 0,isPreviewPrivacyBanner:n.searchParams.get("previewPrivacyBanner")==="true",profileId:_(t.id)}}function P(t){return t>0&&t<1?1:Math.floor(t)}function Ie(t){if(t.rollout)switch(t.rollout.status){case"ACTIVE":return t.effectiveTrafficPercentage!=null&&t.effectiveTrafficPercentage<100?{kind:"traffic",percentage:P(t.effectiveTrafficPercentage)}:{kind:"active"};case"SCHEDULED":return t.rollout.startDate?{kind:"launches",startDate:t.rollout.startDate}:{kind:"scheduled"};case"PAUSED":return{kind:"paused"};default:return{kind:"draft"}}return t.isPublished?t.effectiveTrafficPercentage!=null&&t.effectiveTrafficPercentage<100?{kind:"traffic",percentage:P(t.effectiveTrafficPercentage)}:{kind:"active"}:{kind:"draft"}}const ke=(t,n,r)=>{if(!n)return"";const i=`store/${t.split(".")[0]}`,s=`https://${n}/${n.startsWith("admin")?i:"admin"}/${ge}`;return r?`${s}/profiles/${r}`:s},be=(t,n)=>{if(!n)return"";const r=`store/${t.split(".")[0]}`;return`https://${n}/${n.startsWith("admin")?r:"admin"}`},ye=(t,n,r,i)=>{const s=t?`/checkout/${n}`:"/checkouts",l=encodeURIComponent(r),d=i?`&profile_preview_token=${encodeURIComponent(i)}`:"";return`${window.location.origin}${s}/profile_preview/close?return_to=${l}${d}`};function Le({initialUrl:t}){const{shop:{id:n,myshopifyDomain:r},checkout:{identity:i},source:s}=m(),l=i.current.value==="shopPay",d=s.type==="simulated",c=_e(t),u=parseInt(_(n),10),f=ke(r,c?.adminUrl,c?.profileId),p=be(r,c?.adminUrl),h=b(()=>{y(Pe,!0),window.location.href=ye(l,u.toString(),window.location.pathname,c?.previewToken)},[l,u,c?.previewToken]),I=!d&&c&&!R(),w=s.previewScript?.name,v=w!=null;return c?.isPreviewPrivacyBanner||!I&&!v?null:o(we,{configurationName:w??c?.configurationName??"",rolloutName:v?void 0:c?.rolloutName,closePreview:h,checkoutEditorUrl:f,adminUrl:p,isPreviewingCheckoutScript:v,badge:v?void 0:c?.badge})}export{Le 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.