cloudcommerce 0.0.71 → 0.0.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +1 -0
- package/CHANGELOG.md +16 -0
- package/package.json +2 -2
- package/packages/api/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/frenet/CHANGELOG.md +1 -0
- package/packages/apps/frenet/README.md +1 -0
- package/packages/apps/frenet/lib/frenet.d.ts +2 -0
- package/packages/apps/frenet/lib/frenet.js +6 -0
- package/packages/apps/frenet/lib/frenet.js.map +1 -0
- package/packages/apps/frenet/lib/index.d.ts +1 -0
- package/packages/apps/frenet/lib/index.js +2 -0
- package/packages/apps/frenet/lib/index.js.map +1 -0
- package/packages/apps/frenet/lib-mjs/calculate-frenet.mjs +152 -0
- package/packages/apps/frenet/package.json +28 -0
- package/packages/apps/frenet/src/frenet.ts +7 -0
- package/packages/apps/frenet/src/index.ts +1 -0
- package/packages/apps/frenet/tsconfig.json +6 -0
- package/packages/apps/tiny-erp/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/config/lib/config.js +9 -8
- package/packages/config/lib/config.js.map +1 -1
- package/packages/config/package.json +1 -1
- package/packages/config/src/config.ts +11 -10
- package/packages/events/package.json +1 -1
- package/packages/firebase/lib/config.d.ts +3 -0
- package/packages/firebase/lib/config.js +3 -0
- package/packages/firebase/lib/config.js.map +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/firebase/src/config.ts +3 -0
- package/packages/modules/lib/firebase/call-app-module.js +5 -0
- package/packages/modules/lib/firebase/call-app-module.js.map +1 -1
- package/packages/modules/package.json +2 -1
- package/packages/modules/src/firebase/call-app-module.ts +5 -0
- package/packages/passport/package.json +1 -1
- package/packages/ssr/lib/firebase/serve-storefront.js +6 -5
- package/packages/ssr/lib/firebase/serve-storefront.js.map +1 -1
- package/packages/ssr/package.json +1 -1
- package/packages/ssr/src/firebase/serve-storefront.ts +6 -5
- package/packages/storefront/dist/client/assets/{404-_...d4aa8aff.css → 404-500-_...d4aa8aff.css} +0 -0
- package/packages/storefront/dist/client/assets/{404-index.d9230d24.css → 404-500-index.d9230d24.css} +0 -0
- package/packages/storefront/dist/client/assets/{index.53a3a3e0.css → 404.b3ead908.css} +1 -1
- package/packages/storefront/dist/client/assets/{404.530428e5.css → 500.d5d7700b.css} +1 -1
- package/packages/storefront/dist/client/assets/{_...98510c96.css → _...c08e0a75.css} +1 -1
- package/packages/storefront/dist/client/assets/index.9745690c.css +1 -0
- package/packages/storefront/dist/server/entry.mjs +398 -115
- package/packages/storefront/package.json +3 -3
- package/packages/storefront/src/env.d.ts +1 -0
- package/packages/storefront/src/{components → lib/components}/Card.astro +0 -0
- package/packages/storefront/src/lib/components/LoginModal.vue +56 -0
- package/packages/storefront/src/{layouts → lib/layouts}/Layout.astro +8 -11
- package/packages/storefront/src/lib/layouts/meta/Head.astro +7 -0
- package/packages/storefront/src/lib/layouts/meta/Json.astro +34 -0
- package/packages/storefront/src/lib/ssr-context.ts +107 -0
- package/packages/storefront/src/lib/views/404.astro +79 -0
- package/packages/storefront/src/lib/views/500.astro +79 -0
- package/packages/storefront/src/lib/views/[...slug].astro +77 -0
- package/packages/storefront/src/lib/views/app/index.astro +0 -0
- package/packages/storefront/src/lib/views/index.astro +87 -0
- package/packages/storefront/src/pages/404.astro +10 -71
- package/packages/storefront/src/pages/500.astro +13 -0
- package/packages/storefront/src/pages/[...slug].astro +7 -76
- package/packages/storefront/src/pages/index.astro +10 -79
- package/packages/storefront/storefront.config.mjs +23 -6
- package/packages/storefront/tsconfig.json +4 -1
- package/packages/types/package.json +1 -1
- package/packages/storefront/src/types.ts +0 -18
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/storefront",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.72",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront with Astro",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"repository": {
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"build": "astro build",
|
|
22
22
|
"preview": "astro preview",
|
|
23
23
|
"astro": "astro",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
24
|
+
"prepare-monorepo": "rm -rf content && ln -s ../../store/functions/ssr/content content",
|
|
25
|
+
"prerelease": "rm content && cp -r ../../store/functions/ssr/content ./"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@astrojs/node": "^1.0.1",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="astro/client" />
|
|
File without changes
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="counter">
|
|
3
|
+
<button @click="subtract()">-</button>
|
|
4
|
+
<pre>{{ count }}</pre>
|
|
5
|
+
<button @click="add()">+</button>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="counter-message">
|
|
8
|
+
<slot />
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
import { ref } from 'vue';
|
|
14
|
+
import config from '@cloudcommerce/config';
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
setup() {
|
|
18
|
+
if (!import.meta.env.SSR) {
|
|
19
|
+
const { lang } = config.get();
|
|
20
|
+
const script = document.createElement('script');
|
|
21
|
+
script.setAttribute(
|
|
22
|
+
'src',
|
|
23
|
+
`https://www.gstatic.com/firebasejs/ui/6.0.1/firebase-ui-auth__${lang}.js`,
|
|
24
|
+
);
|
|
25
|
+
script.setAttribute('async', '');
|
|
26
|
+
window.document.head.appendChild(script);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const count = ref(0);
|
|
30
|
+
const add = () => {
|
|
31
|
+
count.value += 1;
|
|
32
|
+
};
|
|
33
|
+
const subtract = () => {
|
|
34
|
+
count.value -= 1;
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
count,
|
|
38
|
+
add,
|
|
39
|
+
subtract,
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<style>
|
|
46
|
+
.counter {
|
|
47
|
+
display: grid;
|
|
48
|
+
font-size: 2em;
|
|
49
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
50
|
+
margin-top: 2em;
|
|
51
|
+
place-items: center;
|
|
52
|
+
}
|
|
53
|
+
.counter-message {
|
|
54
|
+
text-align: center;
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
---
|
|
2
|
-
import getConfig from '
|
|
2
|
+
import { getConfig } from '../ssr-context';
|
|
3
|
+
import MetaHead from './meta/Head.astro';
|
|
4
|
+
import MetaJson from './meta/Json.astro';
|
|
3
5
|
|
|
4
6
|
export interface Props {
|
|
5
7
|
title: string;
|
|
6
8
|
}
|
|
7
9
|
|
|
8
|
-
const { title } = Astro.props as Props;
|
|
9
10
|
const { lang } = getConfig();
|
|
11
|
+
const { title } = Astro.props as Props;
|
|
10
12
|
---
|
|
11
13
|
|
|
12
14
|
<!DOCTYPE html>
|
|
13
|
-
<html lang=
|
|
15
|
+
<html lang={lang.replace('_', '-')}>
|
|
14
16
|
<head>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
|
18
|
-
<title>{title}</title>
|
|
19
|
-
<link rel="stylesheet" media="print" onload="this.media='all'"
|
|
20
|
-
href="https://www.gstatic.com/firebasejs/ui/6.0.1/firebase-ui-auth.css" />
|
|
17
|
+
<MetaHead />
|
|
18
|
+
<title>{title}</title>
|
|
21
19
|
</head>
|
|
22
20
|
<body>
|
|
23
21
|
<slot />
|
|
24
|
-
<
|
|
25
|
-
src={`https://www.gstatic.com/firebasejs/ui/6.0.1/firebase-ui-auth__${lang}.js`}></script>
|
|
22
|
+
<MetaJson />
|
|
26
23
|
</body>
|
|
27
24
|
</html>
|
|
28
25
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { getConfig } from '../../ssr-context';
|
|
3
|
+
|
|
4
|
+
const {
|
|
5
|
+
storeId,
|
|
6
|
+
lang,
|
|
7
|
+
countryCode,
|
|
8
|
+
currency,
|
|
9
|
+
currencySymbol,
|
|
10
|
+
domain,
|
|
11
|
+
settings,
|
|
12
|
+
} = getConfig();
|
|
13
|
+
|
|
14
|
+
const inlineClientJS = `
|
|
15
|
+
window._settings = ${JSON.stringify({
|
|
16
|
+
...settings,
|
|
17
|
+
store_id: storeId,
|
|
18
|
+
lang,
|
|
19
|
+
country_code: countryCode,
|
|
20
|
+
currency,
|
|
21
|
+
currency_symbol: currencySymbol,
|
|
22
|
+
})};`;
|
|
23
|
+
|
|
24
|
+
const inlineJSONLd = JSON.stringify({
|
|
25
|
+
'@context': 'http://schema.org',
|
|
26
|
+
'@type': 'Organization',
|
|
27
|
+
name: settings.name,
|
|
28
|
+
url: `https://${domain}/`,
|
|
29
|
+
logo: `https://${domain}${settings.logo}`,
|
|
30
|
+
});
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
<script is:inline set:html={inlineClientJS} />
|
|
34
|
+
<script type="application/ld+json" set:html={inlineJSONLd} />
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { AstroGlobal } from 'astro';
|
|
2
|
+
import type { BaseConfig } from '@cloudcommerce/config';
|
|
3
|
+
import api, { ApiError, ApiEndpoint } from '@cloudcommerce/api';
|
|
4
|
+
import _getConfig from '../../storefront.config.mjs';
|
|
5
|
+
import settings from '../../content/settings.json';
|
|
6
|
+
|
|
7
|
+
type CmsSettings = typeof settings;
|
|
8
|
+
|
|
9
|
+
type StorefrontConfig = {
|
|
10
|
+
storeId: BaseConfig['storeId'],
|
|
11
|
+
lang: BaseConfig['lang'],
|
|
12
|
+
countryCode: BaseConfig['countryCode'],
|
|
13
|
+
currency: BaseConfig['currency'],
|
|
14
|
+
currencySymbol: BaseConfig['currencySymbol'],
|
|
15
|
+
domain: CmsSettings['domain'],
|
|
16
|
+
primaryColor: CmsSettings['primary_color'],
|
|
17
|
+
secondaryColor: CmsSettings['secondary_color'],
|
|
18
|
+
settings: CmsSettings,
|
|
19
|
+
dirContent: string,
|
|
20
|
+
// eslint-disable-next-line no-unused-vars
|
|
21
|
+
cms: (filename: string) => Record<string, any> | Array<string>,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const getConfig: () => StorefrontConfig = _getConfig;
|
|
25
|
+
|
|
26
|
+
if (!globalThis.api_prefetch_endpoints) {
|
|
27
|
+
globalThis.api_prefetch_endpoints = ['categories'];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type ApiPrefetchEndpoints = Array<ApiEndpoint>;
|
|
31
|
+
|
|
32
|
+
const loadPageContext = async (Astro: AstroGlobal, {
|
|
33
|
+
cmsCollection,
|
|
34
|
+
apiPrefetchEndpoints = globalThis.api_prefetch_endpoints,
|
|
35
|
+
}: {
|
|
36
|
+
cmsCollection?: string;
|
|
37
|
+
apiPrefetchEndpoints?: ApiPrefetchEndpoints;
|
|
38
|
+
} = {}) => {
|
|
39
|
+
const { slug } = Astro.params;
|
|
40
|
+
const config = getConfig();
|
|
41
|
+
let cmsContent: Record<string, any> | undefined;
|
|
42
|
+
let apiResource: string | undefined;
|
|
43
|
+
let apiDoc: Record<string, any> | undefined;
|
|
44
|
+
const apiState: { [k: string]: Record<string, any> } = {};
|
|
45
|
+
if (slug) {
|
|
46
|
+
if (cmsCollection) {
|
|
47
|
+
cmsContent = config.cms(`${cmsCollection}/${slug}`);
|
|
48
|
+
} else {
|
|
49
|
+
const apiOptions = {
|
|
50
|
+
fetch,
|
|
51
|
+
isNoAuth: true,
|
|
52
|
+
};
|
|
53
|
+
const apiFetchings = [
|
|
54
|
+
api.get(`slugs/${slug}`, apiOptions),
|
|
55
|
+
...apiPrefetchEndpoints.map((endpoint) => api.get(endpoint, apiOptions)),
|
|
56
|
+
];
|
|
57
|
+
try {
|
|
58
|
+
const [slugResponse, ...prefetchResponses] = await Promise.all(apiFetchings);
|
|
59
|
+
apiResource = slugResponse.data.resource;
|
|
60
|
+
apiDoc = slugResponse.data.doc;
|
|
61
|
+
apiState[`${apiResource}/${apiDoc._id}`] = apiDoc;
|
|
62
|
+
prefetchResponses.forEach(({ config: { endpoint }, data }) => {
|
|
63
|
+
apiState[endpoint] = data;
|
|
64
|
+
});
|
|
65
|
+
} catch (e: any) {
|
|
66
|
+
const error: ApiError = e;
|
|
67
|
+
let toUrl: string;
|
|
68
|
+
if (error.statusCode === 404) {
|
|
69
|
+
toUrl = '/404';
|
|
70
|
+
Astro.response.headers.set('Cache-Control', 'public, max-age=120');
|
|
71
|
+
} else {
|
|
72
|
+
console.error(error);
|
|
73
|
+
toUrl = '/500';
|
|
74
|
+
Astro.response.headers.set('X-SSR-Error', error.stack);
|
|
75
|
+
}
|
|
76
|
+
const err: any = new Error(`Load page context failed: ${error.message}`);
|
|
77
|
+
err.originalError = error;
|
|
78
|
+
err.redirectUrl = `${toUrl}?url=${encodeURIComponent(Astro.url.pathname)}`;
|
|
79
|
+
err.astroResponse = Astro.redirect(err.redirectUrl);
|
|
80
|
+
throw err;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
...config,
|
|
86
|
+
cmsContent,
|
|
87
|
+
apiResource,
|
|
88
|
+
apiDoc,
|
|
89
|
+
apiState,
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export default loadPageContext;
|
|
94
|
+
|
|
95
|
+
export {
|
|
96
|
+
getConfig,
|
|
97
|
+
loadPageContext,
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
type PageContext = Awaited<ReturnType<typeof loadPageContext>>;
|
|
101
|
+
|
|
102
|
+
export type {
|
|
103
|
+
StorefrontConfig,
|
|
104
|
+
CmsSettings,
|
|
105
|
+
ApiPrefetchEndpoints,
|
|
106
|
+
PageContext,
|
|
107
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { PageContext } from '../ssr-context';
|
|
3
|
+
import Layout from '../layouts/Layout.astro';
|
|
4
|
+
import Card from '../components/Card.astro';
|
|
5
|
+
|
|
6
|
+
export interface Props {
|
|
7
|
+
pageContext: PageContext;
|
|
8
|
+
}
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<Layout title="Welcome to Astro.">
|
|
12
|
+
<main>
|
|
13
|
+
<h1>404</h1>
|
|
14
|
+
<p class="instructions">
|
|
15
|
+
Check out the <code>src/pages</code> directory to get started.<br/>
|
|
16
|
+
<strong>Code Challenge:</strong> Tweak the "Welcome to Astro" message above.
|
|
17
|
+
</p>
|
|
18
|
+
<ul role="list" class="link-card-grid">
|
|
19
|
+
<Card href="https://docs.astro.build/" title="Documentation" body="Learn how Astro works and explore the official API docs." />
|
|
20
|
+
<Card href="https://astro.build/integrations/" title="Integrations" body="Supercharge your project with new frameworks and libraries." />
|
|
21
|
+
<Card href="https://astro.build/themes/" title="Themes" body="Explore a galaxy of community-built starter themes." />
|
|
22
|
+
<Card href="https://astro.build/chat/" title="Chat" body="Come say hi to our amazing Discord community. ❤️" />
|
|
23
|
+
</ul>
|
|
24
|
+
</main>
|
|
25
|
+
</Layout>
|
|
26
|
+
|
|
27
|
+
<style>
|
|
28
|
+
:root {
|
|
29
|
+
--astro-gradient: linear-gradient(0deg,#4F39FA, #DA62C4);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
h1 {
|
|
33
|
+
margin: 2rem 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
main {
|
|
37
|
+
margin: auto;
|
|
38
|
+
padding: 1em;
|
|
39
|
+
max-width: 60ch;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.text-gradient {
|
|
43
|
+
font-weight: 900;
|
|
44
|
+
background-image: var(--astro-gradient);
|
|
45
|
+
-webkit-background-clip: text;
|
|
46
|
+
-webkit-text-fill-color: transparent;
|
|
47
|
+
background-size: 100% 200%;
|
|
48
|
+
background-position-y: 100%;
|
|
49
|
+
border-radius: 0.4rem;
|
|
50
|
+
animation: pulse 4s ease-in-out infinite;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@keyframes pulse {
|
|
54
|
+
0%, 100% { background-position-y: 0%; }
|
|
55
|
+
50% { background-position-y: 80%; }
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.instructions {
|
|
59
|
+
line-height: 1.6;
|
|
60
|
+
margin: 1rem 0;
|
|
61
|
+
background: #4F39FA;
|
|
62
|
+
padding: 1.0rem;
|
|
63
|
+
border-radius: 0.4rem;
|
|
64
|
+
color: var(--color-bg);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.instructions code {
|
|
68
|
+
font-size: 0.875em;
|
|
69
|
+
border: 0.1em solid var(--color-border);
|
|
70
|
+
border-radius: 4px;
|
|
71
|
+
padding: 0.15em 0.25em;
|
|
72
|
+
}
|
|
73
|
+
.link-card-grid {
|
|
74
|
+
display: grid;
|
|
75
|
+
grid-template-columns: repeat(auto-fit, minmax(24ch, 1fr));
|
|
76
|
+
gap: 1rem;
|
|
77
|
+
padding: 0;
|
|
78
|
+
}
|
|
79
|
+
</style>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { PageContext } from '../ssr-context';
|
|
3
|
+
import Layout from '../layouts/Layout.astro';
|
|
4
|
+
import Card from '../components/Card.astro';
|
|
5
|
+
|
|
6
|
+
export interface Props {
|
|
7
|
+
pageContext: PageContext;
|
|
8
|
+
}
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
<Layout title="Welcome to Astro.">
|
|
12
|
+
<main>
|
|
13
|
+
<h1>5xx</h1>
|
|
14
|
+
<p class="instructions">
|
|
15
|
+
Check out the <code>src/pages</code> directory to get started.<br/>
|
|
16
|
+
<strong>Code Challenge:</strong> Tweak the "Welcome to Astro" message above.
|
|
17
|
+
</p>
|
|
18
|
+
<ul role="list" class="link-card-grid">
|
|
19
|
+
<Card href="https://docs.astro.build/" title="Documentation" body="Learn how Astro works and explore the official API docs." />
|
|
20
|
+
<Card href="https://astro.build/integrations/" title="Integrations" body="Supercharge your project with new frameworks and libraries." />
|
|
21
|
+
<Card href="https://astro.build/themes/" title="Themes" body="Explore a galaxy of community-built starter themes." />
|
|
22
|
+
<Card href="https://astro.build/chat/" title="Chat" body="Come say hi to our amazing Discord community. ❤️" />
|
|
23
|
+
</ul>
|
|
24
|
+
</main>
|
|
25
|
+
</Layout>
|
|
26
|
+
|
|
27
|
+
<style>
|
|
28
|
+
:root {
|
|
29
|
+
--astro-gradient: linear-gradient(0deg,#4F39FA, #DA62C4);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
h1 {
|
|
33
|
+
margin: 2rem 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
main {
|
|
37
|
+
margin: auto;
|
|
38
|
+
padding: 1em;
|
|
39
|
+
max-width: 60ch;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.text-gradient {
|
|
43
|
+
font-weight: 900;
|
|
44
|
+
background-image: var(--astro-gradient);
|
|
45
|
+
-webkit-background-clip: text;
|
|
46
|
+
-webkit-text-fill-color: transparent;
|
|
47
|
+
background-size: 100% 200%;
|
|
48
|
+
background-position-y: 100%;
|
|
49
|
+
border-radius: 0.4rem;
|
|
50
|
+
animation: pulse 4s ease-in-out infinite;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@keyframes pulse {
|
|
54
|
+
0%, 100% { background-position-y: 0%; }
|
|
55
|
+
50% { background-position-y: 80%; }
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.instructions {
|
|
59
|
+
line-height: 1.6;
|
|
60
|
+
margin: 1rem 0;
|
|
61
|
+
background: #4F39FA;
|
|
62
|
+
padding: 1.0rem;
|
|
63
|
+
border-radius: 0.4rem;
|
|
64
|
+
color: var(--color-bg);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.instructions code {
|
|
68
|
+
font-size: 0.875em;
|
|
69
|
+
border: 0.1em solid var(--color-border);
|
|
70
|
+
border-radius: 4px;
|
|
71
|
+
padding: 0.15em 0.25em;
|
|
72
|
+
}
|
|
73
|
+
.link-card-grid {
|
|
74
|
+
display: grid;
|
|
75
|
+
grid-template-columns: repeat(auto-fit, minmax(24ch, 1fr));
|
|
76
|
+
gap: 1rem;
|
|
77
|
+
padding: 0;
|
|
78
|
+
}
|
|
79
|
+
</style>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { PageContext } from '../ssr-context';
|
|
3
|
+
import Layout from '../layouts/Layout.astro';
|
|
4
|
+
|
|
5
|
+
export interface Props {
|
|
6
|
+
pageContext: PageContext;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { pageContext } = Astro.props;
|
|
10
|
+
const { apiResource, apiDoc } = pageContext;
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<Layout title={apiDoc.name}>
|
|
14
|
+
<main>
|
|
15
|
+
<h1>Hello <span class="text-gradient">{apiDoc.name}</span></h1>
|
|
16
|
+
<hr>
|
|
17
|
+
<div class="mt-3">
|
|
18
|
+
<mark>{apiDoc._id}</mark> from <i>{apiResource}</i>
|
|
19
|
+
<p>{Math.random()}</p>
|
|
20
|
+
<em>Lorem ipsum dolor sit amet</em>
|
|
21
|
+
</div>
|
|
22
|
+
</main>
|
|
23
|
+
</Layout>
|
|
24
|
+
|
|
25
|
+
<style>
|
|
26
|
+
:root {
|
|
27
|
+
--astro-gradient: linear-gradient(0deg,#4F39FA, #DA62C4);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
h1 {
|
|
31
|
+
margin: 2rem 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
main {
|
|
35
|
+
margin: auto;
|
|
36
|
+
padding: 1em;
|
|
37
|
+
max-width: 60ch;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.text-gradient {
|
|
41
|
+
font-weight: 900;
|
|
42
|
+
background-image: var(--astro-gradient);
|
|
43
|
+
-webkit-background-clip: text;
|
|
44
|
+
-webkit-text-fill-color: transparent;
|
|
45
|
+
background-size: 100% 200%;
|
|
46
|
+
background-position-y: 100%;
|
|
47
|
+
border-radius: 0.4rem;
|
|
48
|
+
animation: pulse 4s ease-in-out infinite;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@keyframes pulse {
|
|
52
|
+
0%, 100% { background-position-y: 0%; }
|
|
53
|
+
50% { background-position-y: 80%; }
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.instructions {
|
|
57
|
+
line-height: 1.6;
|
|
58
|
+
margin: 1rem 0;
|
|
59
|
+
background: #4F39FA;
|
|
60
|
+
padding: 1.0rem;
|
|
61
|
+
border-radius: 0.4rem;
|
|
62
|
+
color: var(--color-bg);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.instructions code {
|
|
66
|
+
font-size: 0.875em;
|
|
67
|
+
border: 0.1em solid var(--color-border);
|
|
68
|
+
border-radius: 4px;
|
|
69
|
+
padding: 0.15em 0.25em;
|
|
70
|
+
}
|
|
71
|
+
.link-card-grid {
|
|
72
|
+
display: grid;
|
|
73
|
+
grid-template-columns: repeat(auto-fit, minmax(24ch, 1fr));
|
|
74
|
+
gap: 1rem;
|
|
75
|
+
padding: 0;
|
|
76
|
+
}
|
|
77
|
+
</style>
|
|
File without changes
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { PageContext } from '../ssr-context';
|
|
3
|
+
import api from '@cloudcommerce/api';
|
|
4
|
+
import Layout from '../layouts/Layout.astro';
|
|
5
|
+
import Card from '../components/Card.astro';
|
|
6
|
+
|
|
7
|
+
export interface Props {
|
|
8
|
+
pageContext: PageContext;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const products = (await api.get('products')).data.result;
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<Layout title="Welcome to Astro.">
|
|
15
|
+
<main>
|
|
16
|
+
<h1>Welcome to <span class="text-gradient">Astro</span></h1>
|
|
17
|
+
<p class="instructions">
|
|
18
|
+
Check out the <code>src/pages</code> directory to get started.<br/>
|
|
19
|
+
<strong>Code Challenge:</strong> Tweak the "Welcome to Astro" message above.
|
|
20
|
+
</p>
|
|
21
|
+
<ul role="list" class="link-card-grid">
|
|
22
|
+
<Card href="https://docs.astro.build/" title="Documentation" body="Learn how Astro works and explore the official API docs." />
|
|
23
|
+
<Card href="https://astro.build/integrations/" title="Integrations" body="Supercharge your project with new frameworks and libraries." />
|
|
24
|
+
<Card href="https://astro.build/themes/" title="Themes" body="Explore a galaxy of community-built starter themes." />
|
|
25
|
+
<Card href="https://astro.build/chat/" title="Chat" body="Come say hi to our amazing Discord community. ❤️" />
|
|
26
|
+
</ul>
|
|
27
|
+
<ul role="list" class="mt-3 fs-20">
|
|
28
|
+
{products.map((product) => <li>
|
|
29
|
+
<a href={`/${product.slug}`}>{product.sku}</a>
|
|
30
|
+
</li>)}
|
|
31
|
+
</ul>
|
|
32
|
+
</main>
|
|
33
|
+
</Layout>
|
|
34
|
+
|
|
35
|
+
<style>
|
|
36
|
+
:root {
|
|
37
|
+
--astro-gradient: linear-gradient(0deg,#4F39FA, #DA62C4);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
h1 {
|
|
41
|
+
margin: 2rem 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
main {
|
|
45
|
+
margin: auto;
|
|
46
|
+
padding: 1em;
|
|
47
|
+
max-width: 60ch;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.text-gradient {
|
|
51
|
+
font-weight: 900;
|
|
52
|
+
background-image: var(--astro-gradient);
|
|
53
|
+
-webkit-background-clip: text;
|
|
54
|
+
-webkit-text-fill-color: transparent;
|
|
55
|
+
background-size: 100% 200%;
|
|
56
|
+
background-position-y: 100%;
|
|
57
|
+
border-radius: 0.4rem;
|
|
58
|
+
animation: pulse 4s ease-in-out infinite;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@keyframes pulse {
|
|
62
|
+
0%, 100% { background-position-y: 0%; }
|
|
63
|
+
50% { background-position-y: 80%; }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.instructions {
|
|
67
|
+
line-height: 1.6;
|
|
68
|
+
margin: 1rem 0;
|
|
69
|
+
background: #4F39FA;
|
|
70
|
+
padding: 1.0rem;
|
|
71
|
+
border-radius: 0.4rem;
|
|
72
|
+
color: var(--color-bg);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.instructions code {
|
|
76
|
+
font-size: 0.875em;
|
|
77
|
+
border: 0.1em solid var(--color-border);
|
|
78
|
+
border-radius: 4px;
|
|
79
|
+
padding: 0.15em 0.25em;
|
|
80
|
+
}
|
|
81
|
+
.link-card-grid {
|
|
82
|
+
display: grid;
|
|
83
|
+
grid-template-columns: repeat(auto-fit, minmax(24ch, 1fr));
|
|
84
|
+
gap: 1rem;
|
|
85
|
+
padding: 0;
|
|
86
|
+
}
|
|
87
|
+
</style>
|
|
@@ -1,74 +1,13 @@
|
|
|
1
1
|
---
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import View404 from '../lib/views/404.astro';
|
|
3
|
+
import loadPageContext, { PageContext } from '../lib/ssr-context';
|
|
4
|
+
|
|
5
|
+
let pageContext: PageContext;
|
|
6
|
+
try {
|
|
7
|
+
pageContext = await loadPageContext(Astro);
|
|
8
|
+
} catch (err) {
|
|
9
|
+
return err.astroResponse;
|
|
10
|
+
}
|
|
4
11
|
---
|
|
5
12
|
|
|
6
|
-
<
|
|
7
|
-
<main>
|
|
8
|
-
<h1>404</h1>
|
|
9
|
-
<p class="instructions">
|
|
10
|
-
Check out the <code>src/pages</code> directory to get started.<br/>
|
|
11
|
-
<strong>Code Challenge:</strong> Tweak the "Welcome to Astro" message above.
|
|
12
|
-
</p>
|
|
13
|
-
<ul role="list" class="link-card-grid">
|
|
14
|
-
<Card href="https://docs.astro.build/" title="Documentation" body="Learn how Astro works and explore the official API docs." />
|
|
15
|
-
<Card href="https://astro.build/integrations/" title="Integrations" body="Supercharge your project with new frameworks and libraries." />
|
|
16
|
-
<Card href="https://astro.build/themes/" title="Themes" body="Explore a galaxy of community-built starter themes." />
|
|
17
|
-
<Card href="https://astro.build/chat/" title="Chat" body="Come say hi to our amazing Discord community. ❤️" />
|
|
18
|
-
</ul>
|
|
19
|
-
</main>
|
|
20
|
-
</Layout>
|
|
21
|
-
|
|
22
|
-
<style>
|
|
23
|
-
:root {
|
|
24
|
-
--astro-gradient: linear-gradient(0deg,#4F39FA, #DA62C4);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
h1 {
|
|
28
|
-
margin: 2rem 0;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
main {
|
|
32
|
-
margin: auto;
|
|
33
|
-
padding: 1em;
|
|
34
|
-
max-width: 60ch;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.text-gradient {
|
|
38
|
-
font-weight: 900;
|
|
39
|
-
background-image: var(--astro-gradient);
|
|
40
|
-
-webkit-background-clip: text;
|
|
41
|
-
-webkit-text-fill-color: transparent;
|
|
42
|
-
background-size: 100% 200%;
|
|
43
|
-
background-position-y: 100%;
|
|
44
|
-
border-radius: 0.4rem;
|
|
45
|
-
animation: pulse 4s ease-in-out infinite;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
@keyframes pulse {
|
|
49
|
-
0%, 100% { background-position-y: 0%; }
|
|
50
|
-
50% { background-position-y: 80%; }
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.instructions {
|
|
54
|
-
line-height: 1.6;
|
|
55
|
-
margin: 1rem 0;
|
|
56
|
-
background: #4F39FA;
|
|
57
|
-
padding: 1.0rem;
|
|
58
|
-
border-radius: 0.4rem;
|
|
59
|
-
color: var(--color-bg);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.instructions code {
|
|
63
|
-
font-size: 0.875em;
|
|
64
|
-
border: 0.1em solid var(--color-border);
|
|
65
|
-
border-radius: 4px;
|
|
66
|
-
padding: 0.15em 0.25em;
|
|
67
|
-
}
|
|
68
|
-
.link-card-grid {
|
|
69
|
-
display: grid;
|
|
70
|
-
grid-template-columns: repeat(auto-fit, minmax(24ch, 1fr));
|
|
71
|
-
gap: 1rem;
|
|
72
|
-
padding: 0;
|
|
73
|
-
}
|
|
74
|
-
</style>
|
|
13
|
+
<View404 pageContext={pageContext} />
|