cloudcommerce 0.0.75 → 0.0.76

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.
Files changed (56) hide show
  1. package/.vscode/extensions.json +2 -1
  2. package/.vscode/settings.json +9 -0
  3. package/CHANGELOG.md +17 -0
  4. package/package.json +1 -1
  5. package/packages/api/package.json +1 -1
  6. package/packages/apps/correios/package.json +1 -1
  7. package/packages/apps/custom-shipping/package.json +1 -1
  8. package/packages/apps/discounts/package.json +1 -1
  9. package/packages/apps/frenet/package.json +1 -1
  10. package/packages/apps/tiny-erp/package.json +1 -1
  11. package/packages/cli/config/firebase.json +7 -0
  12. package/packages/cli/package.json +1 -1
  13. package/packages/config/package.json +1 -1
  14. package/packages/events/package.json +1 -1
  15. package/packages/firebase/package.json +1 -1
  16. package/packages/modules/package.json +1 -1
  17. package/packages/passport/package.json +1 -1
  18. package/packages/ssr/package.json +1 -1
  19. package/packages/storefront/astro.config.mjs +9 -3
  20. package/packages/storefront/dist/client/assets/_...3d331176.css +1 -0
  21. package/packages/storefront/dist/client/assets/{fallback.9cd2ed3f.css → _...b330a555.css} +1 -1
  22. package/packages/storefront/dist/client/assets/_...c1ec409f.css +4 -0
  23. package/packages/storefront/dist/client/assets/fallback-index.552fd862.css +1 -0
  24. package/packages/storefront/dist/client/assets/{_...27b7eb4d.css → fallback.a3f85892.css} +1 -1
  25. package/packages/storefront/dist/client/assets/{index.c5a9ea80.css → index.73f26ab5.css} +1 -1
  26. package/packages/storefront/dist/client/client.80baece3.js +1 -0
  27. package/packages/storefront/dist/client/hoisted.61a32b69.js +661 -0
  28. package/packages/storefront/dist/server/entry.mjs +326 -161
  29. package/packages/storefront/package.json +6 -1
  30. package/packages/storefront/src/html.d.ts +23 -0
  31. package/packages/storefront/src/lib/components/Card.astro +1 -1
  32. package/packages/storefront/src/lib/components/LoginModal.vue +14 -20
  33. package/packages/storefront/src/lib/layouts/Base.astro +129 -0
  34. package/packages/storefront/src/lib/layouts/Checkout.astro +0 -0
  35. package/packages/storefront/src/lib/layouts/Pages.astro +30 -0
  36. package/packages/storefront/src/lib/layouts/meta/Head.astro +62 -1
  37. package/packages/storefront/src/lib/layouts/meta/Json.astro +49 -10
  38. package/packages/storefront/src/lib/main/Home.astro +84 -0
  39. package/packages/storefront/src/lib/main/Wildcard.astro +0 -0
  40. package/packages/storefront/src/lib/ssr-context.ts +2 -1
  41. package/packages/storefront/src/lib/views/[...slug].astro +3 -3
  42. package/packages/storefront/src/lib/views/fallback.astro +5 -3
  43. package/packages/storefront/src/lib/views/index.astro +4 -3
  44. package/packages/storefront/src/pages/index.astro +7 -2
  45. package/packages/storefront/tailwind.config.ts +0 -0
  46. package/packages/storefront/uno.config.ts +98 -0
  47. package/packages/types/package.json +1 -1
  48. package/packages/storefront/dist/client/LoginModal.d6b935cf.js +0 -1
  49. package/packages/storefront/dist/client/assets/_...b3f65c5c.css +0 -1
  50. package/packages/storefront/dist/client/assets/fallback-index.90217cf0.css +0 -1
  51. package/packages/storefront/dist/client/chunks/index.esm.69f70489.js +0 -1726
  52. package/packages/storefront/dist/client/chunks/index.esm2017.1194d1a1.js +0 -457
  53. package/packages/storefront/dist/client/chunks/runtime-core.esm-bundler.a7337834.js +0 -1
  54. package/packages/storefront/dist/client/client.80b904f3.js +0 -1
  55. package/packages/storefront/dist/client/hoisted.24787260.js +0 -376
  56. package/packages/storefront/src/lib/layouts/Layout.astro +0 -84
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/storefront",
3
3
  "type": "module",
4
- "version": "0.0.75",
4
+ "version": "0.0.76",
5
5
  "description": "E-Com Plus Cloud Commerce storefront with Astro",
6
6
  "main": "src/index.js",
7
7
  "repository": {
@@ -33,9 +33,14 @@
33
33
  "@astrojs/vue": "^1.0.2",
34
34
  "@cloudcommerce/api": "workspace:*",
35
35
  "@cloudcommerce/config": "workspace:*",
36
+ "@iconify-json/heroicons": "^1.1.4",
37
+ "@iconify-json/logos": "^1.1.16",
36
38
  "@nanostores/vue": "^0.6.0",
37
39
  "@picocss/pico": "^1.5.4",
40
+ "@unocss/preset-attributify": "^0.45.21",
41
+ "@unocss/preset-icons": "^0.45.21",
38
42
  "astro": "^1.2.2",
43
+ "color": "^4.2.3",
39
44
  "dotenv": "^16.0.2",
40
45
  "firebase": "^9.9.4",
41
46
  "nanostores": "^0.6.0",
@@ -0,0 +1,23 @@
1
+ /* eslint-disable no-unused-vars */
2
+
3
+ import type { AttributifyAttributes } from '@unocss/preset-attributify';
4
+
5
+ declare global {
6
+ namespace astroHTML.JSX {
7
+ interface HTMLAttributes extends AttributifyAttributes { }
8
+ }
9
+ }
10
+
11
+ declare module '@vue/runtime-dom' {
12
+ interface HTMLAttributes {
13
+ [key: string]: any
14
+ }
15
+ }
16
+
17
+ declare module '@vue/runtime-core' {
18
+ interface AllowedComponentProps {
19
+ [key: string]: any
20
+ }
21
+ }
22
+
23
+ export {};
@@ -6,7 +6,7 @@ export interface Props {
6
6
  }
7
7
  const {href, title, body} = Astro.props;
8
8
  ---
9
- <li class="link-card">
9
+ <li class="link-card" data-theme="light">
10
10
  <a href={href}>
11
11
  <h2>
12
12
  {title}
@@ -2,7 +2,9 @@
2
2
  <div class="counter">
3
3
  <button @click="subtract()">-</button>
4
4
  <pre>{{ count }}</pre>
5
- <button @click="add()">+</button>
5
+ <button @click="add()">
6
+ <div class="i-plus" text="cool-gray-100"></div>
7
+ </button>
6
8
  </div>
7
9
  <div class="counter-message">
8
10
  <slot />
@@ -10,7 +12,7 @@
10
12
  <div id="firebaseui-auth-container"></div>
11
13
  </template>
12
14
 
13
- <script lang="ts">
15
+ <script lang="ts" setup>
14
16
  import { ref } from 'vue';
15
17
  import config from '@cloudcommerce/config';
16
18
 
@@ -29,6 +31,7 @@ const setupFirebaseUi = async () => {
29
31
  document.body.appendChild(script);
30
32
  }),
31
33
  ]);
34
+ // @ts-ignore
32
35
  const { firebase, firebaseui }: { firebase: any, firebaseui: any } = window;
33
36
  const ui = new firebaseui.auth.AuthUI(firebase.auth());
34
37
  console.log(firebase.auth);
@@ -54,24 +57,15 @@ const setupFirebaseUi = async () => {
54
57
  ui.start('#firebaseui-auth-container', uiConfig);
55
58
  };
56
59
 
57
- export default {
58
- setup() {
59
- if (!import.meta.env.SSR) {
60
- setupFirebaseUi();
61
- }
62
- const count = ref(0);
63
- const add = () => {
64
- count.value += 1;
65
- };
66
- const subtract = () => {
67
- count.value -= 1;
68
- };
69
- return {
70
- count,
71
- add,
72
- subtract,
73
- };
74
- },
60
+ if (!import.meta.env.SSR) {
61
+ setupFirebaseUi();
62
+ }
63
+ const count = ref(0);
64
+ const add = () => {
65
+ count.value += 1;
66
+ };
67
+ const subtract = () => {
68
+ count.value -= 1;
75
69
  };
76
70
  </script>
77
71
 
@@ -0,0 +1,129 @@
1
+ ---
2
+ import type { PageContext } from '../ssr-context';
3
+ import Color from 'color';
4
+ import MetaHead from './meta/Head.astro';
5
+ import MetaJson from './meta/Json.astro';
6
+ import '@picocss/pico/css/pico.min.css';
7
+
8
+ export interface Props {
9
+ pageContext: PageContext;
10
+ title?: string;
11
+ }
12
+
13
+ const { pageContext, title } = Astro.props as Props;
14
+ const {
15
+ lang,
16
+ primaryColor,
17
+ secondaryColor,
18
+ cms,
19
+ } = pageContext;
20
+ const cmsCustomCode = cms('code') as typeof import('../../../content/code.json');
21
+
22
+ const brandColors = {
23
+ primary: primaryColor,
24
+ secondary: secondaryColor,
25
+ ...globalThis.storefront_brand_colors,
26
+ };
27
+ const colorVariations = {
28
+ whiter: -0.75,
29
+ white: -0.5,
30
+ lightest: -0.33,
31
+ lighter: -0.21,
32
+ light: -0.1,
33
+ lighten: -0.07,
34
+ base: 0,
35
+ darken: 0.08,
36
+ dark: 0.1,
37
+ darker: 0.13,
38
+ darkest: 0.16,
39
+ black: 0.5,
40
+ ...globalThis.storefront_color_variations,
41
+ };
42
+ const colorCSSVars: Record<string, string> = {};
43
+ Object.keys(brandColors).forEach((colorName) => {
44
+ const color = Color(brandColors[colorName]);
45
+ Object.keys(colorVariations).forEach((colorVariation) => {
46
+ const colorShift = colorVariations[colorVariation];
47
+ const colorLabel = `${colorName}-${colorVariation}`;
48
+ colorCSSVars[colorLabel] = color.darken(colorShift).hex();
49
+ if (!colorLabel.includes('white') && !colorLabel.includes('black')) {
50
+ colorCSSVars[`${colorLabel}-yiq`] = color.isLight()
51
+ ? 'var(--yiq-text-dark)' : 'var(--yiq-text-light)';
52
+ colorCSSVars[`${colorLabel}-rgb`] = `${color.red()}, ${color.green()}, ${color.blue()}`;
53
+ }
54
+ });
55
+ });
56
+ ---
57
+
58
+ <!DOCTYPE html>
59
+ <html lang={lang.replace('_', '-')}>
60
+ <head>
61
+ <MetaHead pageContext={pageContext} title={title} />
62
+ <MetaJson pageContext={pageContext} />
63
+ <slot name="before-head-end">
64
+ {cmsCustomCode.css && <style>{cmsCustomCode.css}</style>}
65
+ {cmsCustomCode.html_head && <Fragment set:html={cmsCustomCode.html_head} />}
66
+ </slot>
67
+ </head>
68
+
69
+ <body>
70
+ <slot />
71
+ <script>
72
+ import { initializeApp } from 'firebase/app';
73
+ import { getAnalytics } from 'firebase/analytics';
74
+ // @ts-ignore
75
+ const firebaseConfig = window.firebaseConfig || {
76
+ apiKey: "AIzaSyCrVzemDgpyp9i6ni7Yc5ZuEVfXYwl-4J0",
77
+ authDomain: "ecom2-002.firebaseapp.com",
78
+ projectId: "ecom2-002",
79
+ storageBucket: "ecom2-002.appspot.com",
80
+ messagingSenderId: "402807248219",
81
+ appId: "1:402807248219:web:cf7d57759751e74776367e",
82
+ measurementId: "G-SC592CE0GB"
83
+ };
84
+ const app = initializeApp(firebaseConfig);
85
+ getAnalytics(app);
86
+ </script>
87
+ <slot name="before-body-end">
88
+ {cmsCustomCode.html_body && <Fragment set:html={cmsCustomCode.html_body} />}
89
+ </slot>
90
+ </body>
91
+ </html>
92
+
93
+ <style is:global define:vars={colorCSSVars}>
94
+ :root {
95
+ --white: #fff;
96
+ --gray: #6c757d;
97
+ --gray-dark: #343a40;
98
+ --yiq-text-light: var(--white);
99
+ --yiq-text-dark: var(--gray-dark);
100
+ }
101
+
102
+ body,
103
+ body [data-theme=light],
104
+ body [data-theme=dark] {
105
+ --primary: var(--primary-base);
106
+ --primary-hover: var(--primary-darkest);
107
+ --primary-focus: var(--primary-whiter);
108
+ --primary-inverse: var(--primary-yiq);
109
+ --secondary: var(--secondary-base);
110
+ --secondary-hover: var(--secondary-darkest);
111
+ --secondary-focus: var(--secondary-whiter);
112
+ --secondary-inverse: var(--secondary-yiq);
113
+ }
114
+
115
+ @media only screen and (prefers-color-scheme: dark) {
116
+ :root:not([data-theme=light]) a {
117
+ --color: var(--primary-lightest);
118
+ }
119
+ :root:not([data-theme=light]) a:is([aria-current], :hover, :active, :focus) {
120
+ --color: var(--primary-light);
121
+ }
122
+ }
123
+ [data-theme=light] a {
124
+ --color: var(--primary) !important;
125
+ }
126
+ [data-theme=light] a:is([aria-current], :hover, :active, :focus) {
127
+ --color: var(--primary-hover) !important;
128
+ }
129
+ </style>
@@ -0,0 +1,30 @@
1
+ ---
2
+ import type { PageContext } from '../ssr-context';
3
+ import Base from './Base.astro';
4
+
5
+ export interface Props {
6
+ pageContext: PageContext;
7
+ title?: string;
8
+ }
9
+
10
+ const { pageContext, title } = Astro.props as Props;
11
+ ---
12
+
13
+ <Base pageContext={pageContext} title={title}>
14
+ <Fragment slot="before-head-end">
15
+ <slot name="before-head-end" />
16
+ </Fragment>
17
+ <slot name="header">
18
+ <div class="i-shopping-cart" text="sky-500" />
19
+ <div class="i-google-pay w-32" />
20
+ <div class="i-logos:apple bg-primary" />
21
+ <div class="i-heroicons:user bg-primary-light" />
22
+ <div class="i-user bg-primary-dark" />
23
+ <div class="i-user bg-secondary-hover" />
24
+ <div class="i-user bg-contrast" />
25
+ </slot>
26
+ <slot />
27
+ <Fragment slot="before-body-end">
28
+ <slot name="before-body-end" />
29
+ </Fragment>
30
+ </Base>
@@ -1,7 +1,68 @@
1
1
  ---
2
+ import type { PageContext } from '../../ssr-context';
3
+ import { img as getImg } from '@ecomplus/utils';
2
4
 
5
+ export interface Props {
6
+ pageContext: PageContext;
7
+ title?: string;
8
+ }
9
+
10
+ const {
11
+ storeId,
12
+ cmsContent,
13
+ apiDoc,
14
+ lang,
15
+ domain,
16
+ primaryColor,
17
+ settings,
18
+ cms,
19
+ } = Astro.props.pageContext;
20
+ const state = apiDoc || cmsContent || {};
21
+ const title = state.meta_title || state.name || state.title || Astro.props.title || settings.name;
22
+ const description = state.meta_description || state.short_description || settings.description;
23
+
24
+ const canonicalUrl = new URL(Astro.url.pathname, Astro.site || `https://${domain}`);
25
+ const cmsSocial = cms('social') as typeof import('../../../../content/social.json');
26
+ const ogLocale = lang.length === 2 ? lang : lang.substring(0, 2) + lang.slice(3).toUpperCase();
27
+ let ogImage: string | undefined;
28
+ if (apiDoc) {
29
+ const picture = getImg(state, null, 'zoom');
30
+ ogImage = picture && picture.url;
31
+ }
32
+ if (!ogImage) {
33
+ if (cmsSocial.og_image) {
34
+ ogImage = cmsSocial.og_image.charAt(0) === '/'
35
+ ? `https://${domain}${cmsSocial.og_image}` : cmsSocial.og_image;
36
+ }
37
+ } else {
38
+ ogImage = ogImage.replace(/(\w+\.)?(ecoms\d)\.com/i, '$2-nyc3.nyc3.cdn.digitaloceanspaces.com');
39
+ }
3
40
  ---
4
41
 
5
42
  <meta charset="UTF-8">
6
43
  <meta name="viewport" content="width=device-width">
7
- <link rel="icon" type="image/x-icon" href="/favicon.ico" />
44
+ <meta name="theme-color" content={primaryColor}>
45
+ <link rel="icon" href={settings.favicon || '/favicon.ico'} />
46
+ <title>{title}</title>
47
+ <meta name="description" content={description}>
48
+ <meta name="author" content={settings.name}>
49
+ <meta name="generator" content="E-Com Plus Cloud Commerce">
50
+ <link rel="canonical" href={canonicalUrl} />
51
+ <link rel="apple-touch-icon" href={settings.icon} />
52
+ <meta name="apple-mobile-web-app-capable" content="yes">
53
+ <meta name="apple-mobile-web-app-status-bar-style" content="default">
54
+
55
+ <meta property="og:site_name" content={settings.name}>
56
+ <meta property="og:url" content={canonicalUrl}>
57
+ <meta property="og:title" content={title}>
58
+ <meta property="og:description" content={description}>
59
+ <meta property="og:type" content="website">
60
+ <meta property="og:locale" content={ogLocale}>
61
+ {ogImage && <meta property="og:image" content={ogImage} />}
62
+ {cmsSocial.fb_app_id && <meta property="fb:app_id" content={cmsSocial.fb_app_id} />}
63
+ <meta name="twitter:card" content="summary">
64
+ {cmsSocial.twitter_username && <meta name="twitter:site" content={cmsSocial.twitter_username} />}
65
+
66
+ <link rel="preconnect" href="https://ecomplus.io/" crossorigin />
67
+ <link rel="dns-prefetch" href="https://ecomplus.io/" />
68
+ <meta name="ecom-store-id" content={String(storeId)}>
@@ -1,25 +1,64 @@
1
1
  ---
2
- import { getConfig } from '../../ssr-context';
2
+ import type { PageContext } from '../../ssr-context';
3
+ import { price as fixPrice } from '@ecomplus/utils';
3
4
 
5
+ export interface Props {
6
+ pageContext: PageContext;
7
+ }
8
+
9
+ const { pageContext } = Astro.props as Props;
4
10
  const {
5
11
  storeId,
12
+ apiResource,
13
+ apiDoc,
6
14
  lang,
7
15
  countryCode,
8
16
  currency,
9
17
  currencySymbol,
10
18
  domain,
11
19
  settings,
12
- } = getConfig();
20
+ } = pageContext;
13
21
 
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
+ let inlineClientJS = `
23
+ window.storefront = ${JSON.stringify({
24
+ settings: {
25
+ ...settings,
26
+ store_id: storeId,
27
+ lang,
28
+ country_code: countryCode,
29
+ currency,
30
+ currency_symbol: currencySymbol,
31
+ },
32
+ })};`;
33
+ if (apiDoc) {
34
+ if (typeof apiDoc.price === 'number') {
35
+ apiDoc.price = fixPrice(apiDoc);
36
+ }
37
+ const slimDocRegex = globalThis.storefront_slim_doc_regex
38
+ || /body|meta|records|description|i18n/;
39
+ const minifyApiDoc = (nestedDoc: any) => {
40
+ if (typeof nestedDoc === 'object' && nestedDoc) {
41
+ if (Array.isArray(nestedDoc)) {
42
+ nestedDoc.forEach((item) => minifyApiDoc(item));
43
+ } else {
44
+ Object.keys(nestedDoc).forEach((field) => {
45
+ if (slimDocRegex.test(field)) {
46
+ delete nestedDoc[field];
47
+ } else {
48
+ minifyApiDoc(nestedDoc[field]);
49
+ }
50
+ });
51
+ }
52
+ }
53
+ return nestedDoc;
54
+ };
55
+ inlineClientJS += `
56
+ window.storefront.context = ${JSON.stringify({
57
+ resource: apiResource,
58
+ doc: minifyApiDoc({ ...apiDoc }),
59
+ timestamp: Date.now(),
22
60
  })};`;
61
+ }
23
62
 
24
63
  const inlineJSONLd = JSON.stringify({
25
64
  '@context': 'http://schema.org',
@@ -0,0 +1,84 @@
1
+ ---
2
+ import type { PageContext } from '../ssr-context';
3
+ import api from '@cloudcommerce/api';
4
+ import Card from '../components/Card.astro';
5
+
6
+ export interface Props {
7
+ pageContext: PageContext;
8
+ }
9
+
10
+ const products = (await api.get('products')).data.result;
11
+ ---
12
+
13
+ <main>
14
+ <h1>Welcome to <span class="text-gradient">Astro</span></h1>
15
+ <p class="instructions">
16
+ Check out the <code>src/pages</code> directory to get started.<br/>
17
+ <strong>Code Challenge:</strong> Tweak the "Welcome to Astro" message above.
18
+ </p>
19
+ <ul role="list" class="link-card-grid">
20
+ <Card href="https://docs.astro.build/" title="Documentation" body="Learn how Astro works and explore the official API docs." />
21
+ <Card href="https://astro.build/integrations/" title="Integrations" body="Supercharge your project with new frameworks and libraries." />
22
+ <Card href="https://astro.build/themes/" title="Themes" body="Explore a galaxy of community-built starter themes." />
23
+ <Card href="https://astro.build/chat/" title="Chat" body="Come say hi to our amazing Discord community. ❤️" />
24
+ </ul>
25
+ <ul role="list" class="mt-3 fs-20">
26
+ {products.map((product) => <li>
27
+ <a href={`/${product.slug}`}>{product.sku}</a>
28
+ </li>)}
29
+ </ul>
30
+ </main>
31
+
32
+ <style>
33
+ :root {
34
+ --astro-gradient: linear-gradient(0deg,#4F39FA, #DA62C4);
35
+ }
36
+
37
+ h1 {
38
+ margin: 2rem 0;
39
+ }
40
+
41
+ main {
42
+ margin: auto;
43
+ padding: 1em;
44
+ max-width: 60ch;
45
+ }
46
+
47
+ .text-gradient {
48
+ font-weight: 900;
49
+ background-image: var(--astro-gradient);
50
+ -webkit-background-clip: text;
51
+ -webkit-text-fill-color: transparent;
52
+ background-size: 100% 200%;
53
+ background-position-y: 100%;
54
+ border-radius: 0.4rem;
55
+ animation: pulse 4s ease-in-out infinite;
56
+ }
57
+
58
+ @keyframes pulse {
59
+ 0%, 100% { background-position-y: 0%; }
60
+ 50% { background-position-y: 80%; }
61
+ }
62
+
63
+ .instructions {
64
+ line-height: 1.6;
65
+ margin: 1rem 0;
66
+ background: #4F39FA;
67
+ padding: 1.0rem;
68
+ border-radius: 0.4rem;
69
+ color: var(--color-bg);
70
+ }
71
+
72
+ .instructions code {
73
+ font-size: 0.875em;
74
+ border: 0.1em solid var(--color-border);
75
+ border-radius: 4px;
76
+ padding: 0.15em 0.25em;
77
+ }
78
+ .link-card-grid {
79
+ display: grid;
80
+ grid-template-columns: repeat(auto-fit, minmax(24ch, 1fr));
81
+ gap: 1rem;
82
+ padding: 0;
83
+ }
84
+ </style>
@@ -18,7 +18,8 @@ type StorefrontConfig = {
18
18
  settings: CmsSettings,
19
19
  dirContent: string,
20
20
  // eslint-disable-next-line no-unused-vars
21
- cms: (filename: string) => Record<string, any> | Array<string>,
21
+ cms: <T extends string>(filename: T) => T extends `${string}/`
22
+ ? Array<string> : Record<string, any>,
22
23
  };
23
24
 
24
25
  const getConfig: () => StorefrontConfig = _getConfig;
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  import type { PageContext } from '../ssr-context';
3
- import Layout from '../layouts/Layout.astro';
3
+ import PagesLayout from '../layouts/Pages.astro';
4
4
 
5
5
  export interface Props {
6
6
  pageContext: PageContext;
@@ -10,7 +10,7 @@ const { pageContext } = Astro.props;
10
10
  const { apiResource, apiDoc } = pageContext;
11
11
  ---
12
12
 
13
- <Layout title={apiDoc.name}>
13
+ <PagesLayout pageContext={pageContext}>
14
14
  <main>
15
15
  <h1>Hello <span class="text-gradient">{apiDoc.name}</span></h1>
16
16
  <hr>
@@ -20,7 +20,7 @@ const { apiResource, apiDoc } = pageContext;
20
20
  <em>Lorem ipsum dolor sit amet</em>
21
21
  </div>
22
22
  </main>
23
- </Layout>
23
+ </PagesLayout>
24
24
 
25
25
  <style>
26
26
  :root {
@@ -1,14 +1,16 @@
1
1
  ---
2
2
  import type { PageContext } from '../ssr-context';
3
- import Layout from '../layouts/Layout.astro';
3
+ import PagesLayout from '../layouts/Pages.astro';
4
4
  import Card from '../components/Card.astro';
5
5
 
6
6
  export interface Props {
7
7
  pageContext: PageContext;
8
8
  }
9
+
10
+ const { pageContext } = Astro.props as Props;
9
11
  ---
10
12
 
11
- <Layout title="Welcome to Astro.">
13
+ <PagesLayout pageContext={pageContext}>
12
14
  <main>
13
15
  <h1>Error :/</h1>
14
16
  <p class="instructions">
@@ -22,7 +24,7 @@ export interface Props {
22
24
  <Card href="https://astro.build/chat/" title="Chat" body="Come say hi to our amazing Discord community. ❤️" />
23
25
  </ul>
24
26
  </main>
25
- </Layout>
27
+ </PagesLayout>
26
28
 
27
29
  <style>
28
30
  :root {
@@ -1,17 +1,18 @@
1
1
  ---
2
2
  import type { PageContext } from '../ssr-context';
3
3
  import api from '@cloudcommerce/api';
4
- import Layout from '../layouts/Layout.astro';
4
+ import PagesLayout from '../layouts/Pages.astro';
5
5
  import Card from '../components/Card.astro';
6
6
 
7
7
  export interface Props {
8
8
  pageContext: PageContext;
9
9
  }
10
10
 
11
+ const { pageContext } = Astro.props as Props;
11
12
  const products = (await api.get('products')).data.result;
12
13
  ---
13
14
 
14
- <Layout title="Welcome to Astro.">
15
+ <PagesLayout pageContext={pageContext} title="">
15
16
  <main>
16
17
  <h1>Welcome to <span class="text-gradient">Astro</span></h1>
17
18
  <p class="instructions">
@@ -30,7 +31,7 @@ const products = (await api.get('products')).data.result;
30
31
  </li>)}
31
32
  </ul>
32
33
  </main>
33
- </Layout>
34
+ </PagesLayout>
34
35
 
35
36
  <style>
36
37
  :root {
@@ -1,6 +1,7 @@
1
1
  ---
2
- import ViewHome from '../lib/views/index.astro';
3
2
  import loadPageContext, { PageContext } from '../lib/ssr-context';
3
+ import PagesLayout from '../lib/layouts/Pages.astro';
4
+ import HomeMain from '../lib/main/Home.astro';
4
5
 
5
6
  let pageContext: PageContext;
6
7
  let loadError: any;
@@ -14,5 +15,9 @@ try {
14
15
  }
15
16
  ---
16
17
 
17
- {pageContext && <ViewHome pageContext={pageContext} />}
18
+ {pageContext &&
19
+ <PagesLayout pageContext={pageContext}>
20
+ <HomeMain pageContext={pageContext} />
21
+ </PagesLayout>
22
+ }
18
23
  {loadError && <Fragment set:html={loadError.responseHTML} />}
File without changes