PageSourceSearch

https://go.chatway.app/assets/useShopifyAuth-CXSiW5RC.js

js chatway.app collected 2026-09-24 15:36:09 UTC 3,361 bytes, 2 lines download raw bytes

1(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`release-202609241050`};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`1e24c9df-b761-468a-91ec-f8a201d3e9ab`,e._sentryDebugIdIdentifier=`sentry-dbid-1e24c9df-b761-468a-91ec-f8a201d3e9ab`)}catch{}})();import{Ot as e}from"./vendor-vue-core-B0avW4A6.js";import{t}from"./user-1VcPMvca.js";import{t as n}from"./toast-nz9AHFzD.js";var r=()=>{let n=e(!1),r=async()=>{if(n.value)return!1;if(window.shopify)return console.log(`App-bridge already loaded`),!0;console.log(`Initializing app-bridge...`);try{n.value=!0;let e=i();if(!e)return!1;a(e);let t=await o();return console.log(t?`App-bridge loaded successfully`:`Failed to load app-bridge`),t}catch(e){return console.error(`Error initializing app-bridge:`,e),!1}finally{n.value=!1}},i=()=>{let e=`17e2a61657104d2ffed4486981037b5b`,n=t().shopifyStore;return n?(console.log(`Shopify config:`,{shop:n,apiKey:e}),{apiKey:e,shop:n}):(console.error(`Missing shop parameter from user store`),null)},a=e=>{let t=[{name:`shopify-api-key`,content:e.apiKey},{name:`shopify-shop`,content:e.shop}];document.querySelectorAll(`meta[name^="shopify-"]`).forEach(e=>e.remove()),t.forEach((e,t)=>{let n=document.createElement(`meta`);n.name=e.name,n.content=e.content,t===0&&document.head.firstChild?document.head.insertBefore(n,document.head.firstChild):document.head.appendChild(n)})},o=()=>new Promise(e=>{let t=document.createElement(`script`);t.src=`https://cdn.shopify.com/shopifycloud/app-bridge.js?v=1.0.0`,t.async=!1,t.onload=()=>e(!0),t.onerror=()=>{console.error(`Failed to load app-bridge script from CDN`),e(!1)},s(t)}),s=e=>{document.head.children.length>1?document.head.insertBefore(e,document.head.children[1]):document.head.appendChild(e)};return{initializeAppBridge:r,isInitializing:n}},i=()=>{let i=e(!1),{initializeAppBridge:a,isInitializing:o}=r(),s=n(),c=async(e=3,t=1e3,n=1e4)=>{if(!window.shopify||!window.shopifyBridgeApp){if(console.log(`App Bridge not found, attempting to initialize...`),!await a())return console.error(`Failed to initialize App Bridge`),i.value=!1,null;await new Promise(e=>setTimeout(e,500))}for(let r=0;r<e;r++)try{console.log(`Getting session token (attempt ${r+1}/${e})...`);let t=await Promise.race([window.shopify.idToken(),new Promise((e,t)=>setTimeout(()=>t(Error(`Token request timed out after ${n}ms`)),n))]);if(t)return console.log(`Token successfully retrieved`),t;console.warn(`Received empty token`)}catch(n){console.error(`Token retrieval error (attempt ${r+1}):`,n),r<e-1&&(console.log(`Retrying in ${t}ms...`),await new Promise(e=>setTimeout(e,t)))}return console.error(`Failed to get session token after ${e} attempts`),null};return{shopifyLoginAttempt:async e=>{if(console.log(i.value,`isLoading`),!i.value)try{i.value=!0;let n=await c();if(!n){s.set({message:`Failed to get app-bridge session. Please refresh the page.`,type:`error`});return}if(!e&&n)return n;e&&await e({app_bridge_session:n,shop:t().shopifyStore,channel:`shopify`})}catch(e){s.set({message:e instanceof Error?e.message:`An unknown error occurred`,type:`error`})}finally{i.value=!1}},getSessionToken:c,isLoading:i,isInitializing:o}};export{r as n,i as t};
2//# sourceMappingURL=useShopifyAuth-CXSiW5RC.js.map

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.