Skip to content

Commit

Permalink
Merge pull request #1 from ildecimo/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
maxdyy committed Aug 9, 2023
2 parents 7c2a9fb + 7a8e2dd commit 95371f1
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 106 deletions.
26 changes: 0 additions & 26 deletions CHANGELOG.md

This file was deleted.

46 changes: 0 additions & 46 deletions CODE_OF_CONDUCT.md

This file was deleted.

31 changes: 0 additions & 31 deletions CONTRIBUTING.md

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"dev": "next dev",
"lint": "next lint",
"start": "next start",
"ngrok": "ngrok http --hostname=webhooks-commerce.ildecimo.com 3000",
"type-check": "tsc --pretty --noEmit",
"format": "prettier --write **/*.{js,ts,tsx}"
},
Expand Down
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Source_Sans_3 } from 'next/font/google';
import { type Metadata } from 'next/types';
import StyledComponentsRegistry from '~/lib/registry';
import ThemeProvider from './theme-provider';
import ThemeProvider from '../components/ThemeProvider';

const sourceSans = Source_Sans_3({
subsets: ['latin'],
Expand Down
2 changes: 1 addition & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import HomePage from './home-page';
import HomePage from '../components/Home';

export default function Page() {
return <HomePage />;
Expand Down
2 changes: 1 addition & 1 deletion src/app/productDescription/[productId]/generator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function Generator({
promptAttributes: DEFAULT_GUIDED_ATTRIBUTES,
});
setInitialLoad(true);
}, []);
}, [initialDescription, setResults]);

return (
<PromptAttributesProvider>
Expand Down
14 changes: 14 additions & 0 deletions src/app/productReview/[productId]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
interface PageProps {
params: { productId: string };
searchParams: { product_name: string };
}

export default function Page(props: PageProps) {
console.log('props', props);

return (
<div>
<h1>Product Review Page from the APP</h1>
</div>
);
}
File renamed without changes.
File renamed without changes.
60 changes: 60 additions & 0 deletions src/lib/appExtensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,27 @@ export const createAppExtension = async ({
if (errors && errors.length > 0) {
throw new Error(errors[0]?.message);
}

// Create the review app extension

const response2 = await fetch(
`${BIGCOMMERCE_API_URL}/stores/${storeHash}/graphql`,
{
method: 'POST',
headers: {
accept: 'application/json',
'content-type': 'application/json',
'x-auth-token': accessToken,
},
body: JSON.stringify(createReviewsAppExtensionMutation()),
}
);

const { errors: errors2 } = await response2.json();

if (errors2 && errors2.length > 0) {
throw new Error(errors2[0]?.message);
}
};

export const getAppExtensions = async ({
Expand Down Expand Up @@ -118,3 +139,42 @@ const createAppExtensionMutation = () => ({
},
},
});

const createReviewsAppExtensionMutation = () => ({
query: `
mutation AppExtension($input: CreateAppExtensionInput!) {
appExtension {
createAppExtension(input: $input) {
appExtension {
id
context
model
url
label {
defaultValue
locales {
value
localeCode
}
}
}
}
}
}`,
variables: {
input: {
context: 'PANEL',
model: 'PRODUCTS',
url: '/productReview/${id}',
label: {
defaultValue: 'Product Review AI',
locales: [
{
value: 'Product Review AI',
localeCode: 'en-US',
},
],
},
},
},
});

0 comments on commit 95371f1

Please sign in to comment.