+ {({ option }) => (
+
{option.name}
-
- {option.values.map(({value, isAvailable, isActive, to}) => {
- return (
-
- {value}
-
- );
- })}
+
+ {option.values.map(
+ ({ value, isAvailable, isActive, to }) => {
+ return (
+
+ {value}
+
+ )
+ },
+ )}
)}
@@ -230,11 +269,15 @@ function ProductForm({product, selectedVariant, variants}) {
{
- window.location.href = window.location.href + '#cart-aside';
+ window.location.href =
+ window.location.href + '#cart-aside'
}}
lines={
selectedVariant
@@ -247,9 +290,11 @@ function ProductForm({product, selectedVariant, variants}) {
: []
}
>
- {selectedVariant?.availableForSale ? 'Add to cart' : 'Sold out'}
+ {selectedVariant?.availableForSale
+ ? 'Add to cart'
+ : 'Sold out'}
- );
+ )
}
diff --git a/jsconfig.json b/jsconfig.json
new file mode 100644
index 0000000..0d5eb68
--- /dev/null
+++ b/jsconfig.json
@@ -0,0 +1,16 @@
+{
+ "compilerOptions": {
+ "checkJs": true,
+ "jsx": "react-jsx",
+ "target": "ES2022",
+ "module": "ES2022",
+ "moduleResolution": "Bundler",
+ "baseUrl": ".",
+ "paths": {
+ "@h2/*": ["app/components/hydrogen/*"],
+ "~/*": ["app/*"]
+ }
+ },
+ "include": ["./**/*.d.ts", "./**/*.js", "./**/*.jsx"]
+ }
+
\ No newline at end of file
diff --git a/server.js b/server.js
index dd6ea94..bac9223 100644
--- a/server.js
+++ b/server.js
@@ -1,6 +1,6 @@
// @ts-ignore
// Virtual entry point for the app
-import * as remixBuild from 'virtual:remix/server-build';
+import * as remixBuild from 'virtual:remix/server-build'
import {
cartGetIdDefault,
cartSetIdDefault,
@@ -8,14 +8,14 @@ import {
createStorefrontClient,
storefrontRedirect,
createCustomerAccountClient,
-} from '@shopify/hydrogen';
+} from '@shopify/hydrogen'
import {
createRequestHandler,
getStorefrontHeaders,
-} from '@shopify/remix-oxygen';
-import {AppSession} from '~/lib/session';
-import {CART_QUERY_FRAGMENT} from '~/lib/fragments';
-import {getLoadContext} from 'server-context-getter';
+} from '@shopify/remix-oxygen'
+import { AppSession } from '~/lib/session'
+import { CART_QUERY_FRAGMENT } from '~/lib/fragments'
+import { getLoadContext } from 'server-context-getter'
/**
* Export a fetch handler in module format.
@@ -32,11 +32,16 @@ export default {
* Open a cache instance in the worker and a custom session instance.
*/
if (!env?.SESSION_SECRET) {
- throw new Error('SESSION_SECRET environment variable is not set');
+ throw new Error(
+ 'SESSION_SECRET environment variable is not set',
+ )
}
// this is pretty ugly but we need to pre-create the Remix Context to have access to the storefront later in this function
- const loadContext = getLoadContext(env, executionContext)(request);
+ const loadContext = getLoadContext(
+ env,
+ executionContext,
+ )(request)
/**
* Create a Remix request handler and pass
@@ -46,9 +51,9 @@ export default {
build: remixBuild,
mode: process.env.NODE_ENV,
getLoadContext: () => loadContext,
- });
+ })
- const response = await handleRequest(request);
+ const response = await handleRequest(request)
if (response.status === 404) {
/**
@@ -60,16 +65,18 @@ export default {
request,
response,
storefront: loadContext.storefront,
- });
+ })
}
- return response;
+ return response
} catch (error) {
// eslint-disable-next-line no-console
- console.error(error);
- return new Response('An unexpected error occurred', {status: 500});
+ console.error(error)
+ return new Response('An unexpected error occurred', {
+ status: 500,
+ })
}
},
-};
+}
/** @typedef {import('@shopify/remix-oxygen').AppLoadContext} AppLoadContext */
diff --git a/utopia/storyboard.js b/utopia/storyboard.js
index c117eec..fbe0cc5 100644
--- a/utopia/storyboard.js
+++ b/utopia/storyboard.js
@@ -6,9 +6,9 @@ import { Image } from '@shopify/hydrogen'
const contextGetter = getLoadContext(
{
- PUBLIC_STORE_DOMAIN: 'praiseful-pear.myshopify.com',
+ PUBLIC_STORE_DOMAIN: '438c73-58.myshopify.com',
PUBLIC_STOREFRONT_API_TOKEN:
- '541564e540184b9648c529272ffa4b53',
+ 'f9ee7cc0a41218b2ce1a5b76ac72cfd5',
},
{
waitUntil: () => {},