forked from gnikyt/laravel-shopify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.blade.php
50 lines (44 loc) · 1.8 KB
/
default.blade.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ \Osiset\ShopifyApp\Util::getShopifyConfig('app_name') }}</title>
@yield('styles')
</head>
<body>
<div class="app-wrapper">
<div class="app-content">
<main role="main">
@yield('content')
</main>
</div>
</div>
@if(\Osiset\ShopifyApp\Util::getShopifyConfig('appbridge_enabled'))
<script src="https://unpkg.com/@shopify/app-bridge{{ \Osiset\ShopifyApp\Util::getShopifyConfig('appbridge_version') ? '@'.config('shopify-app.appbridge_version') : '' }}"></script>
<script>
var AppBridge = window['app-bridge'];
var createApp = AppBridge.default;
var app = createApp({
apiKey: '{{ \Osiset\ShopifyApp\Util::getShopifyConfig('api_key', Auth::user()->name ) }}',
shopOrigin: '{{ Auth::user()->name }}',
forceRedirect: true,
});
</script>
@if(\Osiset\ShopifyApp\getShopifyConfig('turbo_enabled'))
<script>
document.addEventListener("turbolinks:request-start", (event) => {
utils.getSessionToken(app).then((token) => {
let xhr = event.data.xhr;
xhr.open('GET', event.data.url, true);
xhr.setRequestHeader("Authorization", "Bearer " + token);
xhr.send();
});
});
</script>
@endif
@include('shopify-app::partials.flash_messages')
@endif
@yield('scripts')
</body>
</html>