PageSourceSearch

https://gone.run/cdn/shopifycloud/checkout-web/assets/c1/hooks-useReplaceShopPayInHistory.DPpLejwu.js

js gone.run collected 2026-09-25 18:45:31 UTC 3,509 bytes, 1 lines download raw bytes

1import{cJ as f,S as m}from"./addresses-is-address-empty.Bn2lNY_L.js";import{q as y}from"./esnext-vendor.B9Da21W6.js";const h="2026-10",P="2023-04";function S(e){throw new f(`Unsupported API version: ${e}`)}function u(e){return e==="unstable"?"2025-07":e}function p(e,t){if(l(e,t))return!1;const n=u(e);return u(t)<n}function w(e,t){return l(e,t)?!1:!p(e,t)}function l(e,t){const n=u(e);return u(t)===n}function d(e){return{laterThan:t=>p(e,t),earlierThan:t=>w(e,t),equalTo:t=>l(e,t)}}function k(e){return e?d(e).laterThan(h)?h:e:P}function L(e){return d(e).laterThan("2025-07")}function T(e){return e.endsWith("/")?e.slice(0,-1):e}const _=["cart","checkout","storefront"],E=new RegExp(`^shopify:/{0,2}(${_.join("|")})`);function U(e,t){const[n,s]=e.match(E)||[];return n?_.includes(s)?t[s]?.(e,n)??e:e:(e.startsWith("shopify:")&&console.error(new f(`Invalid shopify URL: ${e}`)),e)}function V(e,t){const n=new URL(e).host;return s=>{const o=s.split("storefront/")[1].split("/");o.join("/")==="api/graphql.json"&&o.splice(1,0,t);const c=o.join("/");return`https://${n}/${c}`}}function C(e){return t=>{if(!e)return t;const n=new URL(e);return new URL(t).searchParams.forEach((s,r)=>{n.searchParams.append(r,s)}),n.toString()}}function I(){return(e,t)=>e.replace(t,"")}var x=(e=>(e.CheckoutExtensionsPositioning="read_checkout_extensions_positioning",e.CustomerAddress="read_customer_address",e.CustomerEmail="read_customer_email",e.CustomerName="read_customer_name",e.CustomerPersonalData="read_customer_personal_data",e.CustomerPhone="read_customer_phone",e.NetworkAccessScope="read_checkout_external_data",e.CheckoutExtensionPayments="write_checkout_extension_payments",e.CheckoutExtensionRedeemables="write_checkout_extension_redeemables",e.PaymentSessionModal="write_payment_session_modals",e))(x||{});function A(e){return e.approvalScopes.has("read_checkout_external_data")&&e.capabilities.networkAccess}class b{#e=new Map;syncExtension(t){this.#e.set(t.id,{extensionType:t.type,hasNetworkAccess:A(t),hasApiAccess:t.capabilities.apiAccess})}removeExtension(t){this.#e.delete(t)}has(t,n){const s=t==="networkAccess"?"hasNetworkAccess":"hasApiAccess";for(const r of this.#e.values())if(!(n?.extensionType&&r.extensionType!==n.extensionType)&&r[s])return!0;return!1}}class M{#e=new Map;app(t){let n=this.#e.get(t);return n||(n=new b,this.#e.set(t,n)),n}}function H(e){return e.some(t=>t.deliveryPredictionEligible)}function N({selectedMethods:e,deliveryExpectationLines:t,deliveryPromiseText:n}){const s=new Map;for(const i of t){const{deliveryStrategyHandle:a}=i;a&&s.set(a,i)}const o=e.flatMap(i=>{if(!i.deliveryPredictionEligible)return[];const a=s.get(i.handle);return a?.brandedPromise?.handle==="shop_promise"?[a]:[]})[0];if(!o)return;const c=o.brandedPromise;if(c&&n)return{brandedPromise:c,deliveryPromiseText:n}}const z=()=>{const{shop:{hasStorefront:e},observability:t,url:n}=m();return{replaceShopPayInHistory:y(r=>{typeof window>"u"||(r?window.location.replace(r):e?(t.log("shop_pay_in_history_storefront_redirected","[Shop Pay] Redirecting to storefront url, as replacementUrl is not provided"),window.location.replace(n.storefront())):(t.counter({name:"shop_pay_cannot_replace_browser_history",value:1}),t.log("shop_pay_cannot_replace_browser_history","[Shop Pay] Unable to replace Shop Pay in browser history",{replacementUrl:r,storefrontUrl:n.storefront()})))},[e,t,n])}};export{x as A,P as D,M as a,k as b,A as c,S as d,T as e,I as f,N as g,H as h,L as i,C as j,U as r,V as s,d as t,z as u};

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.